XamlStyler
XamlStyler copied to clipboard
indentation settings from editorconfig are not respected
Describe the bug We have a .editorconfig file at the root of our solution which specifies different indentation settings than those I have configured in Visual Studio's options. When XAML Styler formats a file, the indentation settings from Visual Studio are applied and not the EditorConfig settings.
To Reproduce Steps to reproduce the behavior:
- Have a .editorconfig file with different settings for XAML than Visual Studio
- Format a XAML file using XAML styler
Expected behavior The indentation should respect editorconfig settings, as when not using XAML styler.
External Configuration The used .editorconfig file uses the following:
[*]
end_of_line = crlf
indent_size = 2
indent_style = space
insert_final_newline = true
My Visual Studio settings for XAML are tab size 4 and indentation using 4 spaces.
Version Info (please complete the following information):
- OS: Windows 10 1909
- Visual Studio: 16.7.5
- XAML Styler: Extension 3.2008.4
Thanks for the bug report! This is currently by design, since XAML Styler will either (a) look for Visual Studio indent options or (b) rely on Indent Size in a XAML Styler config. I would recommend setting IndentSize to match your indent settings in .editorconfig to work around this issue.
We have had discussions about whether to switch to leveraging .editorconfig for XAML Styler settings, but it is a non-trivial (breaking) change, so we have not committed to doing this yet. Some more on this in #275.
I have now set my settings like in the .editorconfig file as a workaround. But it is a bit annoying when switching between multiple projects with different settings (which is actually the main reason why we use EditorConfig in the first place).
@jmairboeck that should be fixed by including an external config file in your projects. XAML Styler will use the external config file over the user settings, so including one for every project should make sure that the project specific settings are respected. https://github.com/Xavalon/XamlStyler/wiki/XAML-Styler-Configuration#external-configuration-file