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?
The solution was to go to 'Tools > Options > Text Editor > Basic > VB Specific' and turn 'Pretty Listing' OFF.
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 .
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With