Is there any way to turn off Resharper 7 auto formatting?

前端 未结 1 429
春和景丽
春和景丽 2021-02-14 06:42

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 a

1条回答
  •  孤城傲影
    2021-02-14 07:31

    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.

    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.

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

    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.

    0 讨论(0)
提交回复
热议问题