【问题标题】:Left alignment of comment "ReSharper disable PossibleNullReferenceException" breaks coding style注释“ReSharper disable PossibleNullReferenceException”的左对齐打破了编码风格
【发布时间】:2023-04-02 02:16:01
【问题描述】:

只要有可能的空引用异常,Resharper 建议使用这些 cmets 检查、断言或抑制警告:

// ReSharper disable PossibleNullReferenceException
            objectWhichCouldBeNull.DoSomething();
// ReSharper restore PossibleNullReferenceException

但是,cmets 总是在源代码文档的左边缘缩进。有没有办法让 cmets 与其他代码保持一致,尤其是在使用 Resharper 代码清理功能 (Ctrl-Alt-F) 时?

应该是这样的:

            // ReSharper disable PossibleNullReferenceException
            objectWhichCouldBeNull.DoSomething();
            // ReSharper restore PossibleNullReferenceException

【问题讨论】:

    标签: resharper


    【解决方案1】:

    尝试禁用ReSharper | Options | Code Editing | C# | Formatting Style | Other | Other | Don't indent comments started at first column

    【讨论】:

    • 对不起。刚试了,不行。 Visual Studio 2015 和 ReSharper 10.0.1。
    猜你喜欢
    • 2010-12-17
    • 1970-01-01
    • 2014-02-15
    • 2017-03-31
    • 1970-01-01
    • 2019-01-14
    • 2010-12-04
    • 2013-05-05
    • 2013-01-08
    相关资源
    最近更新 更多