Skip to content

CLI (xstyler) does not expand <Trigger> and <Setter> attributes to separate lines when MaxAttributesPerLine=1 and NoNewLineElements is empty #563

Description

@DavidHollman

Describe the bug

When using the xstyler CLI with MaxAttributesPerLine=1, AttributesTolerance=0, and NoNewLineElements="", <Trigger> and <Setter> elements are kept on a single line. But the VS (2022) plugin with identical settings expands them to one attribute per line, as expected...

To Reproduce

  1. Create a .xaml file containing:
  <Style x:Key="Test" TargetType="ComboBox">
      <Style.Triggers>
          <Trigger Property="Validation.HasError" Value="True">
              <Setter Property="Background" Value="Red"/>
          </Trigger>
      </Style.Triggers>
  </Style>
  1. Run xstyler -f file.xaml -c Settings.XamlStyler with the attached config
  2. but <Trigger> and <Setter> attributes remain on one line

Expected behavior

Both and should be expanded to one attribute per line, matching the VS plugin output:

  <Trigger
      Property="Validation.HasError"
      Value="True"
      >
      <Setter
          Property="Background"
          Value="Red"
          />
  </Trigger>

Screenshots

N/A

External Configuration

  {
      "AttributesTolerance": 0,
      "KeepFirstAttributeOnSameLine": false,
      "MaxAttributesPerLine": 1,
      "NoNewLineElements": "",
      "PutEndingBracketOnNewLine": true
  }

(Full config attached)

Version Info:

  • OS: Windows 11
  • Visual Studio: VS 2022 Professional (Version 17.14.21 (November 2025))
  • XAML Styler: Extension (3.2501.8), Console (3.2501.8)

Additional context

The VS plugin with the same external config file produces the correct output. The CLI appears to have a hardcoded default for NoNewLineElements that includes Trigger and Setter, which overrides the empty setting. Setting NoNewLineElements to "Trigger, Setter" in the config makes the VS plugin match the CLI (both keep them on one line), but this is a workaround — the correct behavior is for the CLI to respect MaxAttributesPerLine=1 for all elements when NoNewLineElements is empty.

Settings.XamlStyler.txt

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions