Store per-project source formatting settings with project properties
I wish it were possible to define per-project editor settings that affect formatting and writing style: tab size, use tabs/spaces, autoindent and so on.
Because, different solutions (or even projects in one solution) can have different coding styles or conventions.
Having to poke in several tabs of environment settings every time as I switch projects is a major annoyance.
Actually the formatting settings are not private user preferences; they are part of a project and should be stored in source sontrol, so that the next person that takes on the code automatically gets the proper settings.
12 comments
-
p.a.
commented
Yes, EditorConfig is what is needed... at least, very close to it!
p.a. -
Jed Hunsaker
commented
There's an NuGet package called EditorConfig which does just this.
-
Olaf van der Spek
commented
I vote for auto-detection too. What if a file is edited that's not part of an opened project/solution?
Settings to trim trailing whitespace and for encoding and end of line style would be nice too. -
James Tryand
commented
This feature is already available within Visual Studio, and has been for a while.
Jim Christophers magnificent powershell tooling to Visual Stuido exposes this functionality.
See: http://www.youtube.com/watch?v=5d7gwoIQNpg (about 2/3 way through) -
Ian William James Halliday commented
There should be settings at each level of granularity, projects, solutions, user (dropbox!). Each overrides the next.
E.g. I have my typical settings that I prefer, but I open some OSS solution with different settings, so it overrides my settings. Further within this solution one particular project is inconsistent with the rest, so it has its own settings which override the solution's settings.
-
Merged from another idea: It would very helpful to have settings across an entire Solution rather than having to repeat them in every Project, such as, Connection Strings, shared directories, email Server names, etc.
-
damianh
commented
Working on OSS projects, this is the bane of my life.
-
rom
commented
I've always found it silly that VS treats formatting settings as a user preference, when clearly it's a per-project preference.
-
saul
commented
Eclipse does this, so VS can too. Or even should. -
-
Qwertie
commented
Another idea is an option to let the editor auto-select between tabs and spaces when opening an existing file (based on whether the file already uses mainly tabs or space indents).
-
Justin Chase commented
I think this is very important for open source developers. When you work on more than one project at any given time and your coding styles are very different this becomes a serious pain point in VS. It would be nice if you could have, by convention, a .vssettings file sitting in the same folder as a .csproj and have it pick up those settings when editing code in that project.
-
Mark H
commented
I really would like this feature too. At present we're prevented from using any tools which perform auto-formatting because they just make our diffs look like garbage.
I think this should also be exteneded to more than just formatting settings - but also per project/solution/configuration settings for debugging, source control and other things. Many settings are project specific rather than user specific, and should be treated in such a way.
Perhaps they should exist as user settings too, but they should be overridden by solution settings, and solution settings be overridden by project settings etc.