使用Visual Studio 2015禁用注释的自动缩进

Joh*_*avo 12 c# resharper comments auto-indent visual-studio

当我在安装了Resharper 9.0.0.0的Visual Studio 2015中保存C#文件时,我查看并搜索了禁用注释缩进的方法.

在开始编写实际代码之前,我想要伪代码.然而,我一直在调整Visual Studio和Resharper的设置无济于事.所以例如我希望评论看起来像:

  private string ToggleString(string input)
    {
        // If input.length is between 1-100
            // All the uppercase letters converted to lowercase.
            // All the lowercase letters converted to uppercase
        // else
            // Return a constructive message.

        return input;
     }
Run Code Online (Sandbox Code Playgroud)

当我保存CTRL+ s它结果是这样的:

private string ToggleString(string input)
{
    // If input.length is between 1-100
    // All the uppercase letters converted to lowercase.
    // All the lowercase letters converted to uppercase
    // else
    // Return a constructive message.

    return input;
 }
Run Code Online (Sandbox Code Playgroud)

如何禁用自动格式?

Eth*_*hyl 5

在VS 2017(C++)中,有一个复选框.

工具| 选项| 文字编辑器| C/C++ | 格式化| 缩进| 保留评论缩进

取消选中它修复了恼人的评论自动格式化.也许VS 2015中存在相同的选项.


Bar*_*osz 0

我认为不可能只省略内联注释格式并仍然进行其他代码清理。

您可以尝试移至 XML 文档注释并尝试使用如图所示的设置

在此输入图像描述