如何阻止 ReSharper 在以注释开头的行之后添加不需要的换行符?
How can I stop ReSharper from adding an unwanted newline after a line preceded by a comment?
我有时会像这样对 "group" 成员使用评论:
// unary operators:
public static readonly string Not = Create(nameof(Not));
public static readonly string Negate = Create(nameof(Negate), "-");
// mathematical operators:
public static readonly string Add = Create(nameof(Add), "+");
public static readonly string Subtract = Create(nameof(Subtract), "-");
快速格式化将在前面有注释的行后插入换行符:
// unary operators:
public static readonly string Not = Create(nameof(Not));
public static readonly string Negate = Create(nameof(Negate), "-");
// mathematical operators:
public static readonly string Add = Create(nameof(Add), "+");
public static readonly string Subtract = Create(nameof(Subtract), "-");
我在哪里关闭它?
对我来说,如果评论是 XML 文档 (/// <summary>...
),ReSharper 插入这样一个换行符是有意义的,但对于常规评论(只有两个斜线)我不想那。
如果没有单独的双斜线评论选项,我宁愿完全关闭它。
我询问了 ReSharper 支持 the same question,他们为我提供了答案:
Please change the following option - ReSharper | Options | Code Editing | C# | Formatting Style | Blank Lines | Around fields to 0.
我认为该选项不会影响我的字段,因为还有一个 Around single-line fields
选项。结果评论被认为是该字段的一部分,这就是该选项无效的原因。
我有时会像这样对 "group" 成员使用评论:
// unary operators:
public static readonly string Not = Create(nameof(Not));
public static readonly string Negate = Create(nameof(Negate), "-");
// mathematical operators:
public static readonly string Add = Create(nameof(Add), "+");
public static readonly string Subtract = Create(nameof(Subtract), "-");
快速格式化将在前面有注释的行后插入换行符:
// unary operators:
public static readonly string Not = Create(nameof(Not));
public static readonly string Negate = Create(nameof(Negate), "-");
// mathematical operators:
public static readonly string Add = Create(nameof(Add), "+");
public static readonly string Subtract = Create(nameof(Subtract), "-");
我在哪里关闭它?
对我来说,如果评论是 XML 文档 (/// <summary>...
),ReSharper 插入这样一个换行符是有意义的,但对于常规评论(只有两个斜线)我不想那。
如果没有单独的双斜线评论选项,我宁愿完全关闭它。
我询问了 ReSharper 支持 the same question,他们为我提供了答案:
Please change the following option - ReSharper | Options | Code Editing | C# | Formatting Style | Blank Lines | Around fields to 0.
我认为该选项不会影响我的字段,因为还有一个 Around single-line fields
选项。结果评论被认为是该字段的一部分,这就是该选项无效的原因。