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

16

我已经寻找了多种方法来禁用在安装了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;
     }

当我按下 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;
 }

我该如何禁用自动格式化?

2个回答

5
在 VS 2017 (C++) 中,有一个复选框可以实现此功能。
工具 | 选项 | 文本编辑器 | C/C++ | 格式化 | 缩进 | 保留注释缩进
取消选中它可以解决令人烦恼的自动格式化评论问题。 可能在 VS 2015 中也存在相同的选项。

那个选项确实存在于VS 2015中,至少适用于C++,并且它为我解决了问题。感谢您的回答! - dbeachy1
我找到了你的VS 2017 C++复选框,但是对于C#没有任何进展。 - R.D. Alkire

0

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

您可以尝试转换为XML Doc注释,并按照图片中的设置进行尝试。

enter image description here


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接