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?
Enable/Disable Format On SaveOpen up VSCode Command Palette by pressing Ctrl + Shift + P. Search and select Open Settings (UI). Just start typing and it will auto-fill. Once there's a match, you can hit enter immediately, or manually click on the right option.
In VS Code, press Ctrl+P and execute ext install insert-spaces .
On Visual Studio 2019:
Tools > Options > Text Editor > C/C++ > Formatting > Spacing
Here change the "Pointer/reference alignment"
Select the option of your choice.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With