22

After updating to version 16.1 of Visual Studio 2019, the code editor for C++ completes double quotation characters. When I type one double quote " it automatically completes it as "".

How to turn this feature off? I tried to look into settings, but could not find in C++ Editors settings or All Languages settings.

Update: it actually only completes when I type wide string literal starting with L. For example, when I type L" it auto-completes it to L""

Update 2: it happens for some .cpp files but not for others. I currently do not see any pattern. Seems like a bug.

Maris B.
  • 2,333
  • 3
  • 21
  • 35

3 Answers3

10

Double quote auto-completion is disabled when automatic brace completion is disabled.

You can disable that in the Tools->Options->Text Editor->C/C++->General menu.

Options menu screenshot

As noted in one of the other answers, that option doesn't work properly in some older versions of Visual Studio 2019.

Adam
  • 882
  • 5
  • 10
  • Thanks for your answer, but the original problem was caused by a bug in the VS. The bug is now fixed, and the problem is gone. – Maris B. Dec 09 '21 at 08:06
  • I added this answer because I found this question via search, and there wasn't an answer that told me which setting to change. – Adam Dec 10 '21 at 19:21
  • Really annoying that you can't disable the quotation mark behavior separately to the braces behavior... – Issung Sep 20 '22 at 05:30
4

Update October 2019: it is fixed now starting from version 16.3.2. If not, then check your settings carefully.

Short version: This is a bug in Visual Studio, and hopefully will be fixed. You can up-vote it here.

Longer version: I decided to report this bug to Visual Studio Team, but someone already did that. So if you are affected by this issue, consider up-voting it.

Link to VS bug tracker: Brace completion when member list is up does not put the character in the right position

Note, that while title of above bug may sound like only Code Analysis is affected, VS Team have marked another - more relevant bug as a duplicate to the above bug (C++ automatic quote completion). And it is not possible to vote closed bug, so only option is to vote the first one I mentioned.

Maris B.
  • 2,333
  • 3
  • 21
  • 35
1

I'm using VS 2019 Community Verssion 16.3.9 and have found that when the marker is in the string, the (Ctrl + Shift) combination toggles automatic double-quote placement on and off.

Kiril Dobrev
  • 839
  • 1
  • 8
  • 12