diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 000000000..2c4e940b5 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "XamlStyler.Console": { + "version": "3.2008.4", + "commands": [ + "xstyler" + ] + } + } +} diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt index 0b9616e30..8931e1ac6 100644 --- a/.github/actions/spelling/excludes.txt +++ b/.github/actions/spelling/excludes.txt @@ -64,3 +64,4 @@ SUMS$ ^\.github/actions/spelling/ ^\.gitignore$ ^doc/reference/master-sequence-list.csv$ +^\XamlStyler.json$ diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt index 639ca0ed0..77b95664d 100644 --- a/.github/actions/spelling/expect/expect.txt +++ b/.github/actions/spelling/expect/expect.txt @@ -2061,6 +2061,7 @@ runtests runtimeclass runuia runut +runxamlformat rvalue RVERTICAL rxvt @@ -2852,6 +2853,7 @@ XResource xsd xsi xsize +xstyler XSubstantial xtended xterm diff --git a/.nuget/packages.config b/.nuget/packages.config index 6b13d8479..fd940a873 100644 --- a/.nuget/packages.config +++ b/.nuget/packages.config @@ -1,4 +1,4 @@ - \ No newline at end of file + diff --git a/XamlStyler.json b/XamlStyler.json new file mode 100644 index 000000000..7981bbfd5 --- /dev/null +++ b/XamlStyler.json @@ -0,0 +1,41 @@ +{ + "AttributesTolerance": 1, + "KeepFirstAttributeOnSameLine": true, + "MaxAttributeCharactersPerLine": 0, + "MaxAttributesPerLine": 1, + "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransform, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter", + "SeparateByGroups": false, + "AttributeIndentation": 0, + "AttributeIndentationStyle": 1, + "RemoveDesignTimeReferences": false, + "EnableAttributeReordering": true, + "AttributeOrderingRuleGroups": [ + "x:Class", + "xmlns, xmlns:x", + "xmlns:*", + "x:Key, Key, x:Name, Name, x:Uid, Uid, Title", + "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom", + "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight", + "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex", + "*:*, *", + "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint", + "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText", + "Storyboard.*, From, To, Duration" + ], + "FirstLineAttributes": "", + "OrderAttributesByName": true, + "PutEndingBracketOnNewLine": false, + "RemoveEndingTagOfEmptyElement": true, + "SpaceBeforeClosingSlash": true, + "RootElementLineBreakRule": 0, + "ReorderVSM": 2, + "ReorderGridChildren": false, + "ReorderCanvasChildren": false, + "ReorderSetters": 0, + "FormatMarkupExtension": true, + "NoNewLineMarkupExtensions": "x:Bind, Binding", + "ThicknessSeparator": 2, + "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin", + "FormatOnSave": true, + "CommentPadding": 2, +} diff --git a/build/scripts/Invoke-FormattingCheck.ps1 b/build/scripts/Invoke-FormattingCheck.ps1 index 8cb8e5f8a..eb5cb3eaa 100644 --- a/build/scripts/Invoke-FormattingCheck.ps1 +++ b/build/scripts/Invoke-FormattingCheck.ps1 @@ -3,12 +3,24 @@ # Checks for code formatting errors. Will throw exception if any are found. function Invoke-CheckBadCodeFormatting() { Import-Module ./tools/OpenConsole.psm1 - Invoke-CodeFormat + + # Don't run the XAML formatter in this step - even if it changes nothing, + # it'll still touch all the .xaml files. + Invoke-CodeFormat -IgnoreXaml + # returns a non-zero exit code if there are any diffs in the tracked files in the repo git diff-index --quiet HEAD -- if ($lastExitCode -eq 1) { + + # Write the list of files that need updating to the log + git diff-index --name-only HEAD + throw "code formatting bad, run Invoke-CodeFormat on branch" } + + # Manually check the formatting of our .xaml files, without touching them. + Verify-XamlFormat + } Invoke-CheckBadCodeFormatting diff --git a/consolegit2gitfilters.json b/consolegit2gitfilters.json index e6267ee92..5a760692b 100644 --- a/consolegit2gitfilters.json +++ b/consolegit2gitfilters.json @@ -38,6 +38,7 @@ ".wrn", ".rec", ".err", + "XamlStyler.json", ".xlsx" ] } diff --git a/samples/ConPTY/GUIConsole/GUIConsole.WPF/App.xaml b/samples/ConPTY/GUIConsole/GUIConsole.WPF/App.xaml index e95139446..2e0fb07ef 100644 --- a/samples/ConPTY/GUIConsole/GUIConsole.WPF/App.xaml +++ b/samples/ConPTY/GUIConsole/GUIConsole.WPF/App.xaml @@ -1,8 +1,6 @@ - - - - - + + + diff --git a/samples/ConPTY/GUIConsole/GUIConsole.WPF/MainWindow.xaml b/samples/ConPTY/GUIConsole/GUIConsole.WPF/MainWindow.xaml index 766abcfca..2c67f1cb0 100644 --- a/samples/ConPTY/GUIConsole/GUIConsole.WPF/MainWindow.xaml +++ b/samples/ConPTY/GUIConsole/GUIConsole.WPF/MainWindow.xaml @@ -1,84 +1,100 @@ - - - - - - - - - - - - - - - - - - - - GUIConsole - - - - - - - - - - - - - - - - - - - + - - + diff --git a/src/cascadia/TerminalControl/TSFInputControl.xaml b/src/cascadia/TerminalControl/TSFInputControl.xaml index 2633bbd12..bc7fca22b 100644 --- a/src/cascadia/TerminalControl/TSFInputControl.xaml +++ b/src/cascadia/TerminalControl/TSFInputControl.xaml @@ -1,18 +1,17 @@ - + + TextDecorations="Underline" + TextWrapping="Wrap" /> diff --git a/src/cascadia/TerminalControl/TermControl.xaml b/src/cascadia/TerminalControl/TermControl.xaml index ac642b037..9e2aecbc5 100644 --- a/src/cascadia/TerminalControl/TermControl.xaml +++ b/src/cascadia/TerminalControl/TermControl.xaml @@ -1,30 +1,31 @@ - - + + + Visibility="Visible"> + CompositionScaleChanged="_SwapChainScaleChanged" + SizeChanged="_SwapChainSizeChanged"> @@ -60,10 +61,9 @@ the MIT License. See LICENSE in the project root for license information. --> - + - + FontStyle="Italic" /> @@ -71,31 +71,33 @@ the MIT License. See LICENSE in the project root for license information. --> - + + Visibility="Collapsed" /> - + PointerReleased="_ReleasePointerCapture" + SmallChange="1" + ValueChanged="_ScrollbarChangeHandler" + ViewportSize="10" /> CurrentFontInfo="_FontInfoHandler" /> - + - - - - - - + + + + - - - - - - - - - - - - - - - - + - + - + - - - @@ -142,152 +137,152 @@ the MIT License. See LICENSE in the project root for license information. --> - + + x:Uid="ColorScheme_RenameErrorTip" /> - + + PreviewKeyDown="NameBox_PreviewKeyDown" + Style="{StaticResource TextBoxSettingStyle}" /> - - - - - + - + + Style="{StaticResource GroupHeaderStyle}" /> - - + + - - + + - - + + - - - - - - - - + + + + + + + + - + + Style="{StaticResource GroupHeaderStyle}" /> - - + + - - - - + + + + - + + Grid.Column="0" + Style="{StaticResource ColorLabelStyle}" /> + Grid.Column="1" + Content="{x:Bind CurrentForegroundColor, Mode=TwoWay}" + ContentTemplate="{StaticResource ColorTableEntryTemplate}" + Style="{StaticResource ColorControlStyle}" /> - + + Grid.Column="0" + Style="{StaticResource ColorLabelStyle}" /> + Grid.Column="1" + Content="{x:Bind CurrentBackgroundColor, Mode=TwoWay}" + ContentTemplate="{StaticResource ColorTableEntryTemplate}" + Style="{StaticResource ColorControlStyle}" /> - + + Grid.Column="0" + Style="{StaticResource ColorLabelStyle}" /> - - - - + + + + + Grid.Column="1" + Content="{x:Bind CurrentSelectionBackgroundColor, Mode=TwoWay}" + ContentTemplate="{StaticResource ColorTableEntryTemplate}" + Style="{StaticResource ColorControlStyle}" /> - + + VerticalAlignment="Center" + Style="{StaticResource DisclaimerStyle}" /> + + + + + + + + + + + + + + diff --git a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml index fed8e8308..741c2d4a6 100644 --- a/src/cascadia/TerminalSettingsEditor/CommonResources.xaml +++ b/src/cascadia/TerminalSettingsEditor/CommonResources.xaml @@ -1,13 +1,14 @@ - - + + - + - + 14.0 @@ -15,99 +16,127 @@ the MIT License. See LICENSE in the project root for license information. --> 0,24,0,0 250 - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml index 467fe60fa..84c1408ae 100644 --- a/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml +++ b/src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml @@ -1,70 +1,72 @@ - - + + - + - - + + - - + + - + - + SelectedItem="{x:Bind CurrentTheme, Mode=TwoWay}" /> - + - + - + - + - + - + - + - + - + - + SelectedItem="{x:Bind CurrentTabWidthMode, Mode=TwoWay}" /> - - + + - + diff --git a/src/cascadia/TerminalSettingsEditor/Interaction.xaml b/src/cascadia/TerminalSettingsEditor/Interaction.xaml index 701e12a1d..dcff3f70e 100644 --- a/src/cascadia/TerminalSettingsEditor/Interaction.xaml +++ b/src/cascadia/TerminalSettingsEditor/Interaction.xaml @@ -1,63 +1,65 @@ - - + + - + - - + + - + - - + Margin="0"> + + - + - + - + - + - + - + - + - + SelectedItem="{x:Bind CurrentTabSwitcherMode, Mode=TwoWay}" /> - + - + diff --git a/src/cascadia/TerminalSettingsEditor/Launch.xaml b/src/cascadia/TerminalSettingsEditor/Launch.xaml index eed1b6039..c75f4d788 100644 --- a/src/cascadia/TerminalSettingsEditor/Launch.xaml +++ b/src/cascadia/TerminalSettingsEditor/Launch.xaml @@ -1,30 +1,34 @@ - - + + - + - - + + - - @@ -32,7 +36,7 @@ the MIT License. See LICENSE in the project root for license information. --> - + Style="{StaticResource ComboBoxSettingStyle}"> - + - - - - + + + + - + + Text="{x:Bind Name}" /> @@ -67,52 +69,51 @@ the MIT License. See LICENSE in the project root for license information. --> - + - + Style="{StaticResource ComboBoxSettingStyle}" /> - + - + - + - + SelectedItem="{x:Bind CurrentLaunchMode, Mode=TwoWay}" /> - + - + SelectedItem="{x:Bind CurrentWindowingBehavior, Mode=TwoWay}" /> - + - + + Style="{StaticResource SubtitleTextBlockStyle}" /> - + - + - + - + diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.xaml b/src/cascadia/TerminalSettingsEditor/MainPage.xaml index 92b824c70..9f0fcab6f 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.xaml +++ b/src/cascadia/TerminalSettingsEditor/MainPage.xaml @@ -1,41 +1,42 @@ - - + + - + + TintOpacity="0.5" /> + TintOpacity="0.5" /> + TintOpacity="0.7" /> @@ -43,98 +44,102 @@ the MIT License. See LICENSE in the project root for license information. --> - + - + - + - + + Tag="Rendering_Nav"> - + + Tag="Actions_Nav"> - + - + - - + - - + + - + - - + + - + - + - - + VerticalAlignment="Center" + Style="{StaticResource DisclaimerStyle}" /> - + - - + + - + + HasSettingValue="{x:Bind State.Profile.HasColorSchemeName, Mode=OneWay}" + SettingOverrideSource="{x:Bind State.Profile.ColorSchemeNameOverrideSource, Mode=OneWay}"> - + - + - - + - + - + + IsEnabled="{x:Bind State.Profile.UsingMonospaceFont, Mode=OneWay}" /> - + - + Style="{StaticResource NumberBoxSettingStyle}" + Value="{x:Bind State.Profile.FontSize, Mode=TwoWay}" /> - - + + Style="{StaticResource ComboBoxSettingStyle}" /> - + + Style="{StaticResource CustomSliderControlGridStyle}" + Visibility="{x:Bind IsCustomFontWeight, Mode=OneWay}"> - - + + + Maximum="1000" + Minimum="0" + TickFrequency="50" + TickPlacement="Outside" + Value="{x:Bind State.Profile.FontWeight, Converter={StaticResource FontWeightConverter}, Mode=TwoWay}" /> + Text="{Binding ElementName=FontWeightSlider, Path=Value, Mode=OneWay}" /> - + - + - + - + - + - + HasSettingValue="{x:Bind State.Profile.HasCursorShape, Mode=OneWay}" + SettingOverrideSource="{x:Bind State.Profile.CursorShapeOverrideSource, Mode=OneWay}"> + - + - - + + + Minimum="1" + Value="{x:Bind State.Profile.CursorHeight, Mode=TwoWay}" /> + Style="{StaticResource SliderValueLabelStyle}" + Text="{Binding ElementName=CursorHeightSlider, Path=Value, Mode=OneWay}" /> - + - + - - + + HasSettingValue="{x:Bind State.Profile.HasBackgroundImagePath, Mode=OneWay}" + SettingOverrideSource="{x:Bind State.Profile.BackgroundImagePathOverrideSource, Mode=OneWay}"> - +