visual-studio Visual Studio 代码格式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/289456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio code formatting
提问by Miron Brezuleanu
I've been using Visual Studio as my main IDE for a while now (I still use Emacs for some personal projects, though).
一段时间以来,我一直使用 Visual Studio 作为我的主要 IDE(不过,我仍然将 Emacs 用于一些个人项目)。
I like the way Emacs formats C/C++ code and I'd like to convince Visual Studio use similar conventions for C# code. For instance, in Emacs, a C function call looks like:
我喜欢 Emacs 格式化 C/C++ 代码的方式,我想说服 Visual Studio 对 C# 代码使用类似的约定。例如,在 Emacs 中,C 函数调用如下所示:
functionName(argument1,
argument2,
argument3);
while in the C# code formatted by Visual Studio a function call looks like:
而在 Visual Studio 格式化的 C# 代码中,函数调用如下所示:
functionName(argument1,
argument2,
argument3);
which seems worse to me.
这对我来说似乎更糟。
Is there a way to tweak Visual Studio code formatting rules? Any plugins that can handle that?
有没有办法调整 Visual Studio 代码格式规则?有什么插件可以处理吗?
Many thanks,
非常感谢,
回答by Ed Guiness
Tools > Options > Text Editor > C# > Formatting
工具 > 选项 > 文本编辑器 > C# > 格式
and
和
http://www.jetbrains.com/resharper/features/code_formatting.html#Code_Formatting
http://www.jetbrains.com/resharper/features/code_formatting.html#Code_Formatting
回答by Jiyosub
Resharper (above) is good. CodeRush is now free from DevExpress. I've enjoyed using their products over the years.
Resharper(上图)很好。CodeRush 现在从 DevExpress 中免费。多年来我一直喜欢使用他们的产品。
http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/
http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX/
回答by manuc66
See also this extension that will automate the process each time a file is saved : https://visualstudiogallery.msdn.microsoft.com/3ea1c920-69c4-441f-9979-ccc2752dac56
另请参阅每次保存文件时都会自动执行此过程的扩展:https: //visualstudiogallery.msdn.microsoft.com/3ea1c920-69c4-441f-9979-ccc2752dac56

