禁用右括号吞咽? [英] Disable closing bracket swallowing?
问题描述
当您将光标放在 ]
、)
或 }
前面并键入该字符时,而不是将其插入 vscode移过那个字符,产生 ]*cursor here*
而不是 ]*cursor here*]
.正因为如此,每次我实际上需要插入一个结束括号时,我都需要移动到 ))))
的末尾来输入它,而不是直接输入它.那么有没有办法禁用这种行为(不禁用括号自动完成)?
When you have the cursor in front of a ]
, )
or }
and you type that character, instead of inserting it vscode just moves past that character, producing ]*cursor here*
instead of ]*cursor here*]
. Becacuse of this, every time I actually need to insert a closing bracket I need to move to the end of the ))))
to type it, instead of just being able to type it directly. So is there a way to disable this behavior(without disabling bracket auto-completion)?
这里 是同样的问题,但对于崇高的文本,这个家伙提到它作为自动关闭括号的副作用.
Here is the same question, but for sublime text, and this guy mentions it as a side effect of auto-closing brackets.
推荐答案
我从vscode项目的github上收到了一个解决方案.
这个对我有用.编辑您的 keybindings.json
添加以下文本:
I received a solution from github of vscode project.
It works for me. Edit your keybindings.json
add the text below:
{
"key": "]",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "]"
}
},
{
"key": "Shift+]",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": "}"
}
},
{
"key": "Shift+0",
"command": "editor.action.insertSnippet",
"when": "editorTextFocus",
"args": {
"snippet": ")"
}
}
注意:Shift+0"代表en键盘(
,根据你的键盘布局编辑它.
Notice: "Shift+0" for en keyboard (
, edit it for your keyboard layout.
这篇关于禁用右括号吞咽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!