如何禁用字符串内的自动关闭单引号?

ext*_*xts 4 string auto-close visual-studio-code

我喜欢自动关闭括号、引号等的功能......但是当你在一个字符串中时,例如:“ <inside here>”并且你开始输入单引号,或者如果引号被倒置,它会尝试在字符串中自动配对引号细绳。有没有办法在字符串中禁用此功能?

ifc*_*fig 6

// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,
Run Code Online (Sandbox Code Playgroud)

在您的settings.json文件中将禁用自动关闭括号、圆括号、引号等。

没有单独的开关来选择性地禁用报价匹配,只有一个全局设置。

  • 没有专门用于引号的 VS Code 功能。你所看到的就是你得到的。 (2认同)

qiu*_*qiu 5

截至 2018 年 8 月,在VSCode 1.27中,有一个设置可以禁用最新版本 VSCode 中所有引号的自动关闭。将其添加到您的:settings.json

"editor.autoClosingQuotes": "never"
Run Code Online (Sandbox Code Playgroud)

如果您想针对特定语言禁用此功能,请将上述设置嵌套在特定于语言的设置下。例如,要专门针对该scheme语言禁用此功能,

"[scheme]": {
  "editor.autoClosingQuotes": "never",
},
Run Code Online (Sandbox Code Playgroud)

不幸的是,我认为没有一个选项可以专门禁用单引号或双引号的自动关闭。