是否有C#的自动代码格式化?

编程入门 行业动态 更新时间:2024-10-09 17:22:06
本文介绍了是否有C#的自动代码格式化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的工作,我用C#代码处理大部分时下,用java洒不时。我绝对喜欢关于Eclipse(我知道使用它每天爱它,甚至更多的人)是一个复杂的代码格式,能够塑造代码到任何编码标准可以想象。是否有C#这样的工具? Visual Studio代码格式(键Crtl + K,键Crtl + D)是欠佳和了StyleCop只检查源不固定的。

In my work I deal mostly with C# code nowadays, with a sprinkle of java from time to time. What I absolutely love about Eclipse (and I know people using it daily love it even more) is a sophisticated code formatter, able to mould code into any coding standard one might imagine. Is there such a tool for C#? Visual Studio code formatting (Crtl+K, Crtl+D) is subpar and StyleCop only checks the source without fixing it.

我的梦想工具将从控制台运行(易包括在自动构建或预提交挂钩,并执行在Linux +单声道),有基于文本的文件配置易于存放在项目资源库和预览图形规则编辑器 - 就像Eclipse代码格式化程序

My dream tool would run from console (for easy inclusion in automated builds or pre-commit hooks and for execution on Linux + Mono), have text-file based configuration easy to store in a project repository and a graphical rule editor with preview - just like the Eclipse Code Formatter does.

推荐答案

对于Visual Studio,看看 ReSharper的。这是一个真棒工具和一个明确的必须具备的。 4.0之后的版本有代码的格式,并且你正在寻找清理功能。还有用了StyleCop 插件整合,包括格式设置文件。你可能想代理史密斯插件还有,对于拼写检查标识符和评论。每个解决方案的格式设置文件,可以通过整个团队签入到版本控制系统和共享ReSharper的支持。代码清理键盘快捷键是按Ctrl + E C 。

For Visual Studio, take a look at ReSharper. It's an awesome tool and a definite must-have. Versions after 4.0 have the code formatting and clean-up feature that you are looking for. There's also plugin integration with StyleCop, including formatting settings file. You'll probably want Agent Smith plugin as well, for spell-checking the identifiers and comments. ReSharper supports per-solution formatting setting files, which can be checked into version control system and shared by the whole team. Keyboard shortcut for code cleanup is Ctrl+E C.

在香草​​的Visual Studio,当前文件即可自动格式化键Crtl + K 键Crtl + D 和按Ctrl + K 按Ctrl + F 格式所选文本

In 'vanilla' Visual Studio, current file can be automatically formatted with Crtl+K Crtl+D, and Ctrl+K Ctrl+F formats the selected text.

至于与使用的运行无处不在命令行工具提交挂钩,尝试 NArrange 的。它是免费的,可以同时处理整个目录和运行单以及对Microsoft.Net

As for a runs-everywhere command line tool to be used with commit hooks, try NArrange. It's free, can process whole directories at once and runs on Mono as well as on Microsoft.Net.

有些人也会用的艺术风格命令行工具,虽然它需要Perl和适用于C / C ++代码比用C#。

Some people also use Artistic Style command line tool, although it requires perl and works better with C/C++ code than with C#.

更多推荐

是否有C#的自动代码格式化?

本文发布于:2023-11-29 06:03:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645549.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:代码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!