【问题标题】:Disable auto-indent of comments with Visual Studio 2015使用 Visual Studio 2015 禁用注释的自动缩进
【发布时间】:2017-10-09 12:24:43
【问题描述】:

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

我想在开始编写实际代码之前先编写伪代码。但是,我一直在调整 Visual Studio 和 Resharper 的设置,但无济于事。因此,例如,我希望 cmets 看起来像:

  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;
 }

如何禁用自动格式化?

【问题讨论】:

    标签: c# visual-studio comments resharper auto-indent


    【解决方案1】:

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

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

    取消选中它修复了烦人的评论自动格式。 VS 2015 中可能存在相同的选项。

    【讨论】:

    • 该选项确实存在于 VS 2015 中,至少对于 C++ 而言,它为我解决了问题。感谢您的回答!
    • 我找到了您的 VS 2017 C++ 复选框,但对 C# 没有任何好处。
    【解决方案2】:

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

    您可以尝试转移到 XML Doc cmets 并尝试使用图片中的设置

    【讨论】:

      猜你喜欢
      • 2017-06-19
      • 2015-02-28
      • 2019-10-24
      • 2011-04-09
      • 1970-01-01
      • 2017-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多