Assuming I have the following code in C#:
void Func () {
int i=3;
#if DEBUG
...
#endif
for (int j=0;j<i;j++) {
...
}
}
If I use Edit->Advanced->Format document
, it gets reformatted to this (using my current code formatting settings):
void Func ()
{
int i = 3;
#if DEBUG
...
#endif
for ( int j = 0; j < i; j++ )
{
...
}
}
Is there a way to prevent the #if
and #endif
lines from being moved to the far left? I couldn't find any settings for these but I'm hoping there's a registry setting that controls how this works.
Any advice would be greatly appreciated - this behavior drives me crazy since my code has several hundred such blocks, they keep getting broken by VS.
one style that I've been using is adding space to the # tag like this
void Func ()
{
int i = 3;
# if DEBUG
...
# endif
for ( int j = 0; j < i; j++ )
{
...
}
}
..the if block looks like its lined up with the code correctly and re-formatting code doesn't move the preprocessor tags.
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