[PR #9589] [MERGED] Auto-format our XAML files and enforce in CI #27651

Open
opened 2026-01-31 09:23:17 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/9589
Author: @zadjii-msft
Created: 3/23/2021
Status: Merged
Merged: 3/29/2021
Merged by: @DHowett

Base: mainHead: dev/migrie/xaml-formatting-2.0


📝 Commits (10+)

  • e8c88c6 Just a check to see if this will work in CI
  • 9e330b1 Add the source manually?
  • ff106f6 Bah, these tools all have slightly different args
  • a60c71d I think this stripped the existing BOMs, but I'm worried about the files that didn't have them to start with...
  • 027ba2e I don't think these files had BOMs to begin with. A little worried that the line endings are gonna hyper explode
  • ae4fb6a Actually run the formatter
  • 45970c1 Add the BOM striping to the script
  • e3620a2 Whoops that shouldn't be there
  • eb1776e Fix a build break
  • a541928 spel

📊 Changes

38 files changed (+2863 additions, -2262 deletions)

View changed files

.config/dotnet-tools.json (+12 -0)
📝 .github/actions/spelling/excludes.txt (+1 -0)
📝 .github/actions/spelling/expect/expect.txt (+2 -0)
📝 .nuget/packages.config (+1 -1)
XamlStyler.json (+41 -0)
📝 build/scripts/Invoke-FormattingCheck.ps1 (+13 -1)
📝 consolegit2gitfilters.json (+1 -0)
📝 samples/ConPTY/GUIConsole/GUIConsole.WPF/App.xaml (+6 -8)
📝 samples/ConPTY/GUIConsole/GUIConsole.WPF/MainWindow.xaml (+100 -84)
📝 src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml (+5 -8)
📝 src/cascadia/TerminalApp/App.xaml (+43 -32)
📝 src/cascadia/TerminalApp/ColorPickupFlyout.xaml (+116 -69)
📝 src/cascadia/TerminalApp/CommandPalette.xaml (+500 -490)
📝 src/cascadia/TerminalApp/HighlightedTextControl.xaml (+9 -11)
📝 src/cascadia/TerminalApp/MinMaxCloseControl.xaml (+175 -109)
📝 src/cascadia/TerminalApp/TabHeaderControl.xaml (+77 -74)
📝 src/cascadia/TerminalApp/TabRowControl.xaml (+96 -78)
📝 src/cascadia/TerminalApp/TerminalPage.xaml (+120 -136)
📝 src/cascadia/TerminalApp/TitlebarControl.xaml (+38 -36)
📝 src/cascadia/TerminalControl/SearchBoxControl.xaml (+222 -138)

...and 18 more files

📄 Description

This adds XamlStyler.Console to our solution, and calls it when we
format the code, to also format
our .xaml files.

  • XamlStyler.Console is a dotnet tool so it needs to be restored with
    dotnet tool restore
  • I've added a set of rules to approximately follow @cmaneu's XAML guidelines.
    Those guidelines also recommend things based on the code-behind, which
    this tool can't figure out, but also don't matter that much.
  • There's an extra step to strip BOMs from the output, since Xaml Styler
    adds a BOM by default. Some had them before and others didn't. BOMs
    have been nothing but trouble though.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/9589 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 3/23/2021 **Status:** ✅ Merged **Merged:** 3/29/2021 **Merged by:** [@DHowett](https://github.com/DHowett) **Base:** `main` ← **Head:** `dev/migrie/xaml-formatting-2.0` --- ### 📝 Commits (10+) - [`e8c88c6`](https://github.com/microsoft/terminal/commit/e8c88c6dfafa45abdd0c4517ad875d27df0f4a7f) Just a check to see if this will work in CI - [`9e330b1`](https://github.com/microsoft/terminal/commit/9e330b10d44907f88b56d735e4a5c118dab0c3dd) Add the source manually? - [`ff106f6`](https://github.com/microsoft/terminal/commit/ff106f68d50040e190d02d24c0bf6bab9139e7cc) Bah, these tools all have slightly different args - [`a60c71d`](https://github.com/microsoft/terminal/commit/a60c71d28d897421c266d39d2163224abfda699d) I think this stripped the existing BOMs, but I'm worried about the files that didn't have them to start with... - [`027ba2e`](https://github.com/microsoft/terminal/commit/027ba2e51dcb229672ada1e15f76bc68f02fbec0) I don't think these files had BOMs to begin with. A little worried that the line endings are gonna hyper explode - [`ae4fb6a`](https://github.com/microsoft/terminal/commit/ae4fb6a7929c4f976970c0c1d4ae022c54d124b7) Actually run the formatter - [`45970c1`](https://github.com/microsoft/terminal/commit/45970c10bcd8b9d520e2fed3f7eca35f14a0a9f5) Add the BOM striping to the script - [`e3620a2`](https://github.com/microsoft/terminal/commit/e3620a25b13933534e4ce8ef7a8610964ab62477) Whoops that shouldn't be there - [`eb1776e`](https://github.com/microsoft/terminal/commit/eb1776e09b3c1a80e180e7fc0936734c695a1aec) Fix a build break - [`a541928`](https://github.com/microsoft/terminal/commit/a541928438eb12caa7520b81dc85fd8647e390fc) spel ### 📊 Changes **38 files changed** (+2863 additions, -2262 deletions) <details> <summary>View changed files</summary> ➕ `.config/dotnet-tools.json` (+12 -0) 📝 `.github/actions/spelling/excludes.txt` (+1 -0) 📝 `.github/actions/spelling/expect/expect.txt` (+2 -0) 📝 `.nuget/packages.config` (+1 -1) ➕ `XamlStyler.json` (+41 -0) 📝 `build/scripts/Invoke-FormattingCheck.ps1` (+13 -1) 📝 `consolegit2gitfilters.json` (+1 -0) 📝 `samples/ConPTY/GUIConsole/GUIConsole.WPF/App.xaml` (+6 -8) 📝 `samples/ConPTY/GUIConsole/GUIConsole.WPF/MainWindow.xaml` (+100 -84) 📝 `src/cascadia/LocalTests_TerminalApp/TestHostApp/UnitTestApp.xaml` (+5 -8) 📝 `src/cascadia/TerminalApp/App.xaml` (+43 -32) 📝 `src/cascadia/TerminalApp/ColorPickupFlyout.xaml` (+116 -69) 📝 `src/cascadia/TerminalApp/CommandPalette.xaml` (+500 -490) 📝 `src/cascadia/TerminalApp/HighlightedTextControl.xaml` (+9 -11) 📝 `src/cascadia/TerminalApp/MinMaxCloseControl.xaml` (+175 -109) 📝 `src/cascadia/TerminalApp/TabHeaderControl.xaml` (+77 -74) 📝 `src/cascadia/TerminalApp/TabRowControl.xaml` (+96 -78) 📝 `src/cascadia/TerminalApp/TerminalPage.xaml` (+120 -136) 📝 `src/cascadia/TerminalApp/TitlebarControl.xaml` (+38 -36) 📝 `src/cascadia/TerminalControl/SearchBoxControl.xaml` (+222 -138) _...and 18 more files_ </details> ### 📄 Description This adds [`XamlStyler.Console`] to our solution, and calls it when we format the code, to also format our .xaml files. * `XamlStyler.Console` is a dotnet tool so it needs to be restored with `dotnet tool restore` * I've added a set of rules to approximately follow [@cmaneu's XAML guidelines]. Those guidelines also recommend things based on the code-behind, which this tool can't figure out, but also _don't matter that much_. * There's an extra step to strip BOMs from the output, since Xaml Styler adds a BOM by default. Some had them before and others didn't. BOMs have been nothing but trouble though. [`XamlStyler.Console`]: https://github.com/Xavalon/XamlStyler [@cmaneu's XAML guidelines]: https://github.com/cmaneu/xaml-coding-guidelines --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:23:17 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#27651