Xavalon / XamlStyler

Visual Studio extension to help format your XAML source code
Apache License 2.0
1.18k stars 128 forks source link

Reorder setter - FirstTargetNameThenProperty does not work as expected #372

Open sliwalker opened 2 years ago

sliwalker commented 2 years ago

Describe the bug When using this feature on an example XAML clearly showing an unordered state, it is not reordering at all.

To Reproduce Steps to reproduce the behavior:

  1. Given the following XAML.
  2. Format XAML
  3. No reordering happened.

    <VisualStateManager.VisualStateGroups>
    <VisualStateGroup>
      <VisualState>
         <VisualState.StateTriggers>
            <AdaptiveTrigger MinWindowWidth="720" />
         </VisualState.StateTriggers>
         <VisualState.Setters>
            <Setter Target="ContactActionsList.Width" Value="100" />
            <Setter Target="ContactActionsList.Orientation" Value="Horizontal" />
            <Setter Target="BBB.Orientation" Value="Horizontal" />
            <Setter Target="AAA.Orientation" Value="Horizontal" />
         </VisualState.Setters>
      </VisualState>
    </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>

Expected behavior The result should look like this:

<VisualStateManager.VisualStateGroups>
   <VisualStateGroup>
      <VisualState>
         <VisualState.StateTriggers>
            <AdaptiveTrigger MinWindowWidth="720" />
         </VisualState.StateTriggers>
         <VisualState.Setters>
            <Setter Target="AAA.Orientation" Value="Horizontal" />
            <Setter Target="BBB.Orientation" Value="Horizontal" />
            <Setter Target="ContactActionsList.Orientation" Value="Horizontal" />
            <Setter Target="ContactActionsList.Width" Value="100" />
         </VisualState.Setters>
      </VisualState>
   </VisualStateGroup>
</VisualStateManager.VisualStateGroups>

Screenshots This is my config: image

External Configuration Settings.XamlStyler attached. Settings.XamlStyler.txt

Version Info (please complete the following information):