Open ismay opened 8 years ago
It should work on new files, I created several new files today. Editorconfig does not correct on save, you can use format on save option for that in VS itself.
Can you paste your .editorconfig
file and the exact flow you followed? Also where is the .editorconfig file located and where is the new file located?
Hmm ok. I'm using this config:
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/
root = true
[*]
end_of_line = lf
indent_size = 3
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.cs]
indent_size = 3
[*.{json,txt,html,js}]
indent_size = 4
[*.{xml,scss,css,sql}]
indent_size = 2
With the editorconfig extension (of course:), the .editorconfig
file is at the root of the project.
So I checked it a little further, and when I use Add > New Item > Class
it does seem to apply the editorconfig whitespace settings correctly. But when I use Add > View
(for an MVC project), it uses the whitespace settings from Tools > Options > Text editor
(for a .cs
file in SolutionName/Areas/Admin/Views/FolderName
).
After having used this for a while I can confirm that the editorconfig
plugin in VS2015 doesn't seem to work at all with my .cshtml
files. I don't know what the cause is, but indentation is all over the place and nowhere near what I configured in .editorconfig
.
Very frustrating to work with. Let me know if you need further information for debugging.
I can confirm this too with .cshtml
and other file types.
Editorconfig doesn't apply my
.editorconfig
whitespace settings when I'm creating a new file. And it doesn't correct erroneous whitespace on save either.This kind of defeats the purpose of using editorconfig, as I still have to configure all the whitespace settings manually in Tools > Options > Text editor to make sure that visual studio (2015) creates new files with the correct indentation. Is it possible to apply
.editorconfig
whitespace settings when creating a new file as well? Otherwise it doesn't really make sense to use this plugin.