How to turn off double quotes auto-completion in Visual Studio 2019 for C++ editor?
Asked Answered
B

5

29

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.

Bird answered 22/5, 2019 at 9:40 Comment(1)
I have the same issueApetalous
B
5

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.

Bird answered 4/7, 2019 at 12:11 Comment(2)
Oh, Microsoft, seriously, I have to download 2.07 GB update just to fix a double-quote bug.Edbert
Bug is back for VS 2022 17.0.4Haydenhaydn
P
16

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.

Phalanx answered 8/12, 2021 at 23:7 Comment(3)
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.Bird
I added this answer because I found this question via search, and there wasn't an answer that told me which setting to change.Phalanx
Really annoying that you can't disable the quotation mark behavior separately to the braces behavior...Hydrology
B
5

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.

Bird answered 4/7, 2019 at 12:11 Comment(2)
Oh, Microsoft, seriously, I have to download 2.07 GB update just to fix a double-quote bug.Edbert
Bug is back for VS 2022 17.0.4Haydenhaydn
C
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.

Christyna answered 21/11, 2019 at 12:31 Comment(0)
R
0

To elaborate on Kiril Dobrev's answer, which says:

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.

That's correct, that's where the problem lies. Ctrl+Shift or Ctrl+Space is used to switchinput methods . The issue is that the local input method has auto-completion for characters like ")", "]", "}" and more. Therefore, it's not an issue with Visual Studio at all. Simply switching back to the English input mode will resolve the problem.

Ritch answered 21/10, 2023 at 9:7 Comment(1)
Hi Wang Lao, welcome to Stack Overflow. Your answer looks like a comment to the answer above. Just be patient soon you'll unlock the comment anywhere privilege. Until that moment it might be worth to consider removing this answer.Elvyn
C
0

I don't have enough reputation to comment, but I want to respond to this comment of Issung (and this is also relevant to the original question):

Really annoying that you can't disable the quotation mark behavior separately to the braces behavior...

If you want to disable auto closing of quotes and only quotes, I've found this can actually be done. You have to change relevant language setting file (for example "csharp-language-configuration.json") and remove quotes from section "autoClosingPairs".

This still isn't perfect - for me it only works for newly created files, and not for existing files - but it is a solution, especially if you do that before beginnin a project.

Cone answered 22/5 at 10:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.