Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Visual Studio 2015 comment alignment?

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

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

selecting Edit -> Advanced -> Format Document results in formatting like this:

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

where Visual Studio has assumed two unrelated comments were related and grouped them together. The assumption of relation is because there are consecutive lines, one ending with a comment and the next starting with one. This can, of course, be worked around by adding blank lines but that is not always the best choice depending on the specific code. Note that Visual Studio 2013 did not have this feature.

I was unable to find any mention of this feature via internet searches. This is C#, and Visual Studio is configured to preserve tabs.

Is there any way to disable this one portion of the auto-formatting?

like image 558
Mark Jerde Avatar asked Feb 02 '17 14:02

Mark Jerde


1 Answers

I don't think this is possible. I've found this post on GitHub where one comment mentioned your problem. CyrusNajmabadi wrote:

Interestingly enough, we added some support to align comments over multiple lines. So, for example, in the example being mentioned, post format you end up with:

Comment alignment

Alignment is an interesting problem, and currently we have no support for alignment to happen with tabs when formatting between tokens. However, it gets more and more complex considering you might have these comments attached to items which themselves get moved around by formatting and thus may have their locations move to places that are not on tabstop boundaries.

like image 136
diiN__________ Avatar answered Sep 23 '22 01:09

diiN__________