auto formatting new line after inline block comment

750 views Asked by At

Visual Studio autoformat places a new line after all block comments - at least the one I am using. It does so obviously only for those comments, which come first on a line.

/*mark1*/ double[] a = new /*mark2*/ double[100]; 

is formated to:

/*mark1*/ 
double[] a = new /*mark2*/ double[100];  

Since I am using inline block comments as marks for a code replication tool, I want to disable that 'feature' for all block comments. Auto format should simply ignore them.

/*mark1*/ double[] a = new /*mark2*/ double[100]; 

should not break the line while auto formatting.

Is this possible and how? I tried everything in the "New Lines" section in the C# formatting settings, but without luck.

2

There are 2 answers

0
user492238 On BEST ANSWER

I suppose, it's simply not possible.

0
Eric Liu On
#pragma warning disable IDE0055
        /*mark1*/ double[] a = new /*mark2*/ double[100];
#pragma warning restore IDE0055

Hackish way, because there is no proper way to set up formatting for this, so why not just temporarly disable formatting. You can also use #pragma warning disable format