Visual C ++ continues to destroy code formatting alignment

I am working on an open source project that uses horizontal alignment in the source code. The code is written in C ++, and I'm using Visual Studio 2013. Visual Studio tries to be smart about the interval, but ends up destroying my alignment manually.

A typical piece of code looks like this:

bool  β†’   β†’   β†’ GetFieldWithType  β†’   β†’ ( int idx, cc8* name, int type );
bool  β†’   β†’   β†’ GetFieldWithType  β†’   β†’ ( int idx, int key, int type );
static cc8*   β†’ GetLuaTypeName    β†’   β†’ ( int type );
void* β†’   β†’   β†’ GetPtrUserData    β†’   β†’ ( int idx );

Now, if I add another line in the same way as I type the opening bracket (after two tabs), Visual Studio deletes the two tabs I entered and replaces them with a single space. I try to be patient and press Ctrl + Z to cancel automatic formatting. But as soon as I type a semicolon, it kills tabs again and again.

I found an option in Tools> Options> Text Editor> C / C ++> Formatting> Interval> Interval for function parentheses, which allows you to insert a space before the opening bracket of the argument list . If I deactivate this option, VS still insists on deleting the tabs before the opening bracket, it just does not add a space. How to get rid of this behavior?

To be clear: I'm fine with VS, automatically inserting spaces (according to what I configured). I don’t want to deactivate automatic formatting at all. I just don’t want it to remove the space that I just entered manually.

+4
1

Tools > Options > Text Editor > C/C++.

Tabs " " "Keep tabs". , VS , .

Formatting > Spacing () " ...".

, !

+4

Source: https://habr.com/ru/post/1532045/


All Articles