Search code examples
c++visual-studio-2022

In Visual Studio 2022: how do I disable the automatic insertion of space around function arguments?


Visual Studio 2022 automatically inserts spaces around the arguments that I pass to functions.

If I write: f(number); Visual Studio 2022 (C++) automatically changes this to: f( number );

I am using CMake (not .sln). How do I disable this functionality?


Solution

  • Likely you have the option "Insert space without parentheses of an argument list" turned on, you can go into: Tools > Options, then expand Text Editor > C/C++ > Code Style > Formatting > Spacing, in which you can turn that option on or off.

    Here's an image of how that setting looks when it is turned on, if that's what you see then turn it off. If it's already off, I don't know why those spaces are being inserted.

    image of the option