2

I've recently started working with C# at work and I'm using Visual Studio 2017 for it because of the UI development integration and intellisense it has. I previously have used Atom and Visual Studio Code for my Python, C++, and Golang work and I've found a feature that VS2017 seems to missing is the ability to type a quotation mark or parentheses when a block of code is selected and it puts it on either side of selection automatically. VS2017 just overwrites the selection with that character.

I've googled around and have yet to find anything that specifically mentions this, but is there are way I can do this without having to install an extension like Resharper and have to mess with hotkeys?

RPiAwesomeness
  • 5,009
  • 10
  • 34
  • 52

1 Answers1

0

Just found the solution for parentheses () and braces {}. Tools > Options... > Text Editor > C/C++ > Advanced. In section Text Editor there are two options, Enable Surround with Braces, and Enable Surround with Parentheses. Change them to true, select some text and type either { or (.

There is an alternative solution that requires you to define a new snippet, name it for instance {}, and then use the "shortcut" Ctrl+K,Ctrl+S,{,Enter. But it actually doesn't work quite as good as the built-in thing.

Dialecticus
  • 16,400
  • 7
  • 43
  • 103