Disable comment alignment for Visual Studio 2015?

In Visual Studio 2015, if you have code like this:

var foo = that.Bar(); // Get the value //foo++; 

selecting Edit β†’ Advanced β†’ Document format leads to formatting as follows:

 var foo = that.Bar(); // Get the value //foo++; 

where Visual Studio suggested that two unrelated comments were linked and grouped together. The assumption of the relationship is due to the fact that there are consecutive lines, one of which ends with a comment, and the next starts with one. Of course, this can be circumvented by adding blank lines, but this is not always the best choice depending on the specific code. Please note that Visual Studio 2013 does not have this feature.

I could not find a mention of this feature through an online search. This is C #, and Visual Studio is configured to save tabs.

Is there any way to disable this part of autoformatting?

+7
comments c # indentation text-editor visual-studio-2015
source share
1 answer

I do not think that's possible. I found this post on GitHub where one comment mentioned your problem. CyrusNajmabadi wrote:

Interestingly, we added some support for aligning comments across multiple lines. So, for example, in the above example, in post format, you end up:

Comment alignment

Alignment is an interesting issue, and we currently do not support tabbed alignment when formatting between tokens. However, it is becoming more complex, given that you can add these comments to elements that themselves move by formatting and, thus, can move to places that are not at the borders of the tabletop.

+1
source share

All Articles