Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can visual studio automatically indent / format preprocessing directives? [duplicate]

Possible Duplicate:
How to force indentation of C# conditional directives?

Say I want to type this in Visual Studio:

    class Program
    {
        private const Byte NUM_THREADS =
        #if DEBUG
            1;
        #else
            8;
        #endif
    }

If I simply type it out (i.e. not manually fix any indentation), Visual Studio will format it like this:

    class Program
    {
        private const Byte NUM_THREADS =
#if DEBUG
 1;
#else
        8;
#endif
    }

Is there anything I can do so it automatically indents so it looks like the first example?

like image 443
David S. Avatar asked May 11 '12 08:05

David S.


1 Answers

Unfortunately, there is no way to have preprocessor commands follow the code indentation. Wish it did though. :(

It looks like the reason is previous compilers barfed at spaces that appeared before the commands, according to: Indenting #defines

like image 91
Nyaarium Avatar answered Sep 18 '22 08:09

Nyaarium