visual-studioautocompleteformatting

How to disable automatic brace surrounding on selection in Visual Studio


Everything was fine until one update changed a formatting setting and I don't know how to reverse it.

Whenever I select C++ code and try to replace the text with an open brace, it will simply surround the selected text, instead of replacing it with the open brace.

The behavior

This gets really frustrating after a while, e.g. trying to replace a < less symbol with a > symbol is now impossible when using selection. How can I disable this behavior?


I am using Visual Studio Community 2022 Version 17.4.0


Solution

  • To disable this mode, head to:

    Tools -> Options -> Text Editor -> C/C++ -> Advanced

    and set Auto Surround Mode to Never.

    Disable Auto Surround Mode