Are there any plugins for Visual Studio which automatically formats code how I like?

☆樱花仙子☆ 提交于 2019-12-10 23:36:24

问题


When I open any code file, whether something i've written or something from another developer, I want it to automatically format it with my preference of bracing, indentation, line spacing, etc..

Ideally, when saving a file to disk, it would only save the formatting for code/lines i've touched. It would still display the rest of the code formatted, however it would not save these to disk (so as to not piss off other developers).


回答1:


You could use Resharper for this. It will show warnings for formatting inconsistencies (via colored underscores, much like warnings for spellcheckers), and you could instruct it to reformat a selection or a whole file based on either the default formatting rules or your own.

Formatting rules are customizable to fit your own coding standards.




回答2:


Visual Assist X works for both C/C++ and C#. I use it extensively whenever I have the unfortunate needs to do things in Windows :-).

The refactoring tool is awesome. It fixes Visual Studio smart completion. In fact, after you use Visual Assist X, Visual Studio smart completion looks so dump that you won't believe you paid so much for such crappy "smartness".

Of course, Visual Assist X also adds the much needed snippets. You can finally stop drooling when you see those snippet "special moves" when viewing those Textmate screencasts.



来源:https://stackoverflow.com/questions/1437016/are-there-any-plugins-for-visual-studio-which-automatically-formats-code-how-i-l

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!