Search code examples
visual-studioauto-indent

VS2015 indentation inside line


I am using Visual Studio 2015 and develop in C++.
I need VS2015 autoformatting so I can not turn it off, but there is a problem.
I usually write like this:

        LPSTR lpszOneLongLine   = NULL;
        DWORD dwShort           = 0;

But VS2015 does not like this style and corrects it to:

        LPSTR lpszOneLongLine = NULL;
        DWORD dwShort = 0;

How can I disable this behaviour?


Solution

  • You can disable this behavior from settings:

    Tools >> Options >> Text Editor >> C/C++ >> Formatting >> Spacing >> Assignment Operator >> Check Don't change spacing around assignment operators

    enter image description here