How can I stop ReSharper from adding an unwanted newline after a line preceded by a comment?
Answered
I sometimes use comments to "group" members like this:
// 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), "-");
Quick format will insert a newline after the line that is preceded by a comment:
// 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), "-");
Where do I turn this off?
To me it makes sense for ReSharper to insert such a newline if the comment were an XML doc (`/// <summary>...`), but for regular comments (only two slashes) I don't want that.
I'd rather turn it off altogether if there is no separate option for two-slash comments.
Please sign in to leave a comment.
Hello Martin!
Thank you for contacting us.
Please change the following option - ReSharper | Options | Code Editing | C# | Formatting Style | Blank Lines | Around fields to 0.
Hope it helps.
Thank you.
Thanks Angelina,
I had "Around single-line fields" set to 0, didn't realize the comment is considered part of it.
Works now!
Thank you for feedback, Martin.
Please feel free to contact us in case of any questions or problems.