有没有任何插件的Visual Studio自动格式化代码我喜欢什么? [英] Are there any plugins for Visual Studio which automatically formats code how I like?

查看:534
本文介绍了有没有任何插件的Visual Studio自动格式化代码我喜欢什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开任何代码文件,无论是我写的东西还是其他开发人员的东西,我想让它自动格式化我的偏好支撑,缩进,行间距等。

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).

推荐答案

您可以使用 Resharper 进行此操作。它将显示格式不一致的警告(通过彩色下划线,很像法术检查者的警告),并且可以指示它根据默认格式规则或您自己的格式重新格式化选择内容或整个文件。

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.

这篇关于有没有任何插件的Visual Studio自动格式化代码我喜欢什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆