I suggest you ...

Add "Automatically format on #" in C# Formatting Options

In Options->Text Editor->C#->Formatting->General there are three options:

- Automatically format statement on ;
- Automatically format block on }
- Automatically format on paste

Please add:
- Automatically format on #

I would like to be able to disable automatic formatting when typing #. Currently if you type # in the editor the whole script is auto-formatted when I don't want it to be.

9 votes
Sign in
Password icon
Signed in as (Sign out)
You have left! (?) (thinking…)
Gavin Thornton shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


Sign in
Password icon
Signed in as (Sign out)
  • Philippe commented  ·   ·  Flag as inappropriate

    Currently, writing a # is very annoying in Visual Studio 2015 as it mess up every region afterward.

    1 #region --- first region --- typically indented
    2 # <--- Writing this
    3 #endregion

    As soon as # is inserted on line 2, #region on line 3 get undented and stay that way. Since I use Visual Studio 2015, I spent too much time reformatting the code. Visual Studio get it right when we first write the code but mess everything when editing an existing file.

    An additional option might be welcome but they have to fix that kind of issue.

    In fact, I would like that formatting would only apply to code before the cursor. We, humans, write code from left to right. The fact the IDE try to take into account text after the cursor is often annoying when we insert code.

    The same issue also apply to IntelliSense. Many edition are hard to do because of the way Roslyn handle edition. Older version of Visual Studio were way better at handling edition when the code is invalid.

  • Gavin Thornton commented  ·   ·  Flag as inappropriate

    Correction: "the whole script is auto-formatted" should read "the whole functions # statements are auto-formatted".

Feedback and Knowledge Base