I created .editorconfig
file at solution level in VS 2019 with following settings:
root = true
# All files
[*]
indent_style = tab
indent_size = 4
tab_width = 4
Then I restarted the IDE so the changes can take effect. However only .editorconfig
file itself uses the selected settings. All other files in my solution still use spaces and not settings defined in the config.
I then placed the .editorconfig
file at project level and restarted yet again. No change.
How do I properly use .editorconfig
file so all my project files use the settings defined in it?
Note: I am using latest version of VS 2019 Community.
According with documentation, you have to use "Format Document" or "Code cleanup" to apply the format to existing code.
When you add an EditorConfig file to your project in Visual Studio, new lines of code are formatted according to the EditorConfig settings. The formatting of existing code is not changed unless you run one of the following commands:
- Code Cleanup (Ctrl+K, Ctrl+E), which applies any white space settings, such as indent style, and selected code style settings, such as how to sort using directives.
- Edit > Advanced > Format Document (or Ctrl+K, Ctrl+D in the default profile), which only applies white space settings, such as indent style.
Source: https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With