Search code examples
c++visual-studio-2017visual-studio-community

How to disable auto-spacing of * after a type in Visual Studio 2017?


When I want to type something like

Type* name;

at some point during typing the line (as soon as I type the semicolon), VS2017 decides to auto-space to

Type * name;

After I removed the space the first time, the IDE didn't try that again for some time. The behaviour started again for some reason when I typed a type-pointer variable, but immediately typing another line like that didn't repeat the auto spacing...

After some more testing, the auto-spacing only seems to happen in a class where the first line of code after an access specifier becomes the victim if it matches Type* name;.

class Foo {
private:
    Type* name; //Becomes Type * name; after typing the ';'
public:
    Type2* name2; //Here as well
};

I don't like it. How do I end this blasphemy?


Solution

  • Go to Tools->Options, then Text Editor-C>/C++->Formatting->Spacing and look through the options, however I do not believe that particular item is configurable.