Xavalon / XamlStyler

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

XamlStyler moves <!--#endregion--> wrongly #437

Closed Baka632 closed 1 year ago

Baka632 commented 1 year ago

Describe the bug When XAML source code contains <!--#endregion-->, XamlStyle moves it wrongly

Before formatting:

<!--#region Visual State Manager-->
<VisualStateManager.VisualStateGroups/>
<!--#endregion-->

After formatting:

<!--#endregion-->

<!--#region Visual State Manager-->
<VisualStateManager.VisualStateGroups/>

To Reproduce Steps to reproduce the behavior:

  1. Format XAML source code that contains <!--#endregion-->
  2. See error

Expected behavior <!--#endregion--> should follow the previous XAML element

Screenshots Before: image

After: image

External Configuration No

Version Info (please complete the following information):

Additional context No

grochocki commented 1 year ago

Can you only reproduce this issue with VisualStateManager? If so, can you try setting ReorderVSM to "None" and see if you can still reproduce the issue?

Baka632 commented 1 year ago

Yes, I can only reproduce this issue with VisualStateManager

And after setting ReorderVSM to "None", the issue disappeared.

grochocki commented 1 year ago

Is leaving that setting as "None" feasible for your project? The challenge here is that the region could be around any arbitrary block of XAML.

Baka632 commented 1 year ago

Yes it is feasible for my project.

Usually VisualStateManager is very long so I use region to keep my code tidy and I won't add other XAML element inside.

grochocki commented 1 year ago

Thanks for confirming! Going to close this as wont fix for now as there is a viable workaround for handling VSM.