Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't apply settings to new files #34

Open
ismay opened this issue Jan 14, 2016 · 4 comments
Open

Doesn't apply settings to new files #34

ismay opened this issue Jan 14, 2016 · 4 comments

Comments

@ismay
Copy link

ismay commented Jan 14, 2016

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
Copy link
Member

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
Copy link
Author

ismay commented Jan 14, 2016

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
Copy link
Author

ismay commented Jan 29, 2016

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
Copy link

jerone commented Feb 18, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants