Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable auto-indent of comments with Visual Studio 2015

I have looked and searched for ways to disable indentation of comments when I save C# files in Visual Studio 2015 with Resharper 9.0.0.0 installed.

I'd like to pseudocode before I start writing actual code. However I have been tweaking with both Visual studio's and Resharper's settings to no avail. So for example I want the comments to look like:

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

When I save CTRL + s it turn out like this:

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

How do I disable the auto-format?

like image 890
Johnny Bravo Avatar asked May 10 '17 17:05

Johnny Bravo


People also ask

How do I turn off auto align in Visual Studio?

The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF.

How do I block indent in Visual Studio?

Visual studio's smart indenting does automatically indenting, but we can select a block or all the code for indentation. Use either of the two ways to indentation the code: Shift + Tab , Ctrl + k + f .

How do I turn on auto indent in Visual Studio?

Auto formatting settings in Visual Studio Show activity on this post. Select the text you want to automatically indent. Click menu Edit → Advanced → *Format Selection, or press Ctrl + K , Ctrl + F . Format Selection applies the smart indenting rules for the language in which you are programming to the selected text.


1 Answers

In VS 2017 (C++) there is a checkbox for this.

Tools | Options | Text  Editor | C/C++ | Formatting | Indentation | Preserve indentation of comments

Unchecking it fixed annoying comment auto-formatting. Maybe the same option exists in VS 2015.

like image 83
Ethyl Avatar answered Sep 19 '22 02:09

Ethyl