有没有办法关闭 Resharper 7 自动格式化? [英] Is there any way to turn off Resharper 7 auto formatting?

查看:41
本文介绍了有没有办法关闭 Resharper 7 自动格式化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我发疯了,我尝试过 Resharper 支持但没有解决方案,但想知道是否有人遇到过这种情况.

This has been driving me crazy, I've tried Resharper support with no solution, but wondered if anyone out there has experienced this.

当我更新现有方法并点击花括号或分号时,我得到了双缩进:

When I update an existing method and hitting the curly brace or semi-colon, I am getting a double indent:

public void abc(int a, int b) {
      var c;   // <- after hitting return after the curly brace
   var d;
   var e;
}

有什么办法可以完全关闭 Resharper 格式吗?或者至少解决这个问题?我查看了 Resharper->Code Editing->C#,但没有找到任何有用的东西.

Is there any way to completely turn off Resharper formatting? Or at least fix this problem? I've looked in the Resharper->Code Editing->C# but didn't find anything that worked.

PS - 这是在 VS 2010 上

PS - This is on VS 2010

推荐答案

ReSharper 和 Visual Studio 都具有自动格式化功能.但在 C# 中,它们通常是通过按下 ; 来触发的.或 },不是通过回车,所以要么你描述了你的行为错误,要么你遇到了某种错误.

Both ReSharper and Visual Studio have auto-formatting. But in C# they are usually triggered by pressing ; or }, not by carriage return, so either you describe your actions wrong or you've hit some kind of bug.

要关闭 ReSharper 自动格式化,请转至 ReSharper |选项 -> 环境 |编辑器并关闭分号自动格式化"和右大括号自动格式化".如果这对解决您的错误没有帮助,您可能还需要关闭同一页面上的自动插入右括号".

To turn off ReSharper auto-formatting, go to ReSharper | Options -> Environment | Editor and turn off "Auto-format on semicolon" and "Auto-format on closing brace". If that won't help against your bug you may want also to turn off "Auto-insert closing brace" on the same page.

要关闭 Visual Studio 自动格式化,请转到工具 |选项 -> 文本编辑器 |C# |格式化 |常规并关闭自动格式化..."选项.

To turn off Visual Studio auto-formatting, go to Tools | Options -> Text Editor | C# | Formatting | General and turn off "Automatically format ... " options.

但即使没有自动格式化,重构和快速修复仍将完成,因此您可能需要调整格式化选项(除了或代替关闭自动格式化).首先,转到工具|选项 -> 文本编辑器 |C# |标签.确保制表符大小和缩进大小相等(ReSharper 在此不支持不同的值)并且具有正确的值.还可以选择插入空格和保留制表符.然后转到 ReSharper |选项 -> 代码编辑 |C# |格式样式 |大括号布局.从你的代码来看,你更喜欢 K&R 风格.因此,为此页面上的前 6 个选项选择K&R 样式"值.这些是最重要的设置,但您可能还想查看其他格式样式设置,以便更好地针对您的样式进行调整.

But even without auto-format formatting would still be done on refactorings and quick fixes, so you may want to tune formatting options (besides or instead of turning off auto-format). First of all, go to Tools | Options -> Text Editor | C# | Tabs. Make sure that tab size and indent size are equal (ReSharper doesn't support different values here) and have correct value. Also choose between Insert spaces and Keep tabs. Then go to ReSharper | Options -> Code Editing | C# | Formatting style | Braces layout. Judging by your code, you prefer K&R style. So select "K&R style" value for the first 6 options on this page. These are most important settings, but you may also want to look at other formatting style settings to better adjust them for your style.

这篇关于有没有办法关闭 Resharper 7 自动格式化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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