I've activated automatic code formatting in Visual Studio 2015 for a legacy C++ project.
The problem is that code lines after specific macros calls (not closing with a semicolon since its inside the macro) are always indented. I'm searching for a setting in Visual Studio 2015 to prevent this, without me having to install another extension, the need to change the macro definition itself or to ask everybody to add an additional semicolon to the call (which would fix it).
Here is an minimal example of how the code and the resulting problem looks like:
#include <iostream>
#ifdef _DEBUG
# define MY_TRACE(X) do { std::cout << X << std::endl; } while (0);
#else
# define MY_TRACE(X) {}
#endif
int main()
{
MY_TRACE( "Hello World!" )
return 0;
}
So I have the following settings which does automatically indent e.g. on <Enter>
or with }
:
And the following settings for indentation:
I've tried all possible and impossible combinations of the settings there and elsewhere (including e.g. turning of "Tabs/Indenting/Smart"). Every time Visual Studio C++ editor did continue to indent the line after the macro.
I also couldn't find anything on SO or the internet. The closest I got, but didn't had an answer or where for an different editor/language: