Disable closing bracket swallowing?

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": ")"
}
}

Notice: "Shift+0" for en keyboard (, edit it for your keyboard layout.


It is indeed a side effect of the autoClosingBrackets setting of the editor.

If you go to File > Preferences > Settings to open the settings JSON file, you can search for "editor" or "autoClosing" and copy the entry to your user settings if you whish to change/disable it (it's enabled by default), or just copy this to disable it:

// Controls if the editor should automatically close brackets after opening them
"editor.autoClosingBrackets": false,

More on VS Code settings, as well as a list of the default settings can be found here: https://code.visualstudio.com/docs/getstarted/settings

If you disable this setting:

  • Typing a bracket or quote won't automatically add a matching, closing bracket or quote.
  • Typing a (closing) bracket before an existing one won't cause it to be "absorbed".
  • You'll have to type each closing bracket or quote yourself.
  • You won't be able to automatically enclose selected text with brackets or quotes by selecting it and typing just one bracket/quote. With this option disabled, the selected text will be replace with whatever you type.