editorconfig / editorconfig-visualstudio

EditorConfig Visual Studio Addin
http://editorconfig.org
Other
355 stars 75 forks source link

Doesn't apply settings to new files #34

Open ismay opened 8 years ago

ismay commented 8 years ago

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.

Mpdreamz commented 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?

ismay commented 8 years ago

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).

ismay commented 8 years ago

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.

jerone commented 8 years ago

I can confirm this too with .cshtml and other file types.