Visual Studio Code bracket auto completion

kett picture kett · Apr 9, 2018 · Viewed 15.4k times · Source

This has been annoying me for a while. VSCode doesn't let me type a closing bracked or parenthesis or the like ( ")", "]", "}") when there is already a closing symbol of the same type.

In this WEBM you see me try to set another set of brackets and VSCode skips the closing bracket that I typed. This is extremely annoying. WEBM

How do I disable this behaviour in VSCode? (Or correct it, so VSCode closes the inner bracket for me.)

Edit: I know I can disable auto closing brackets in VSCode with "editor.autoClosingBrackets": false. But I don't want to disable it altogether. I just want to disable the overtyping.

Answer

kett picture kett · Apr 16, 2018

TL;DR: As of June 2019, it's not possible to disable only the overtyping part of the autocloseBrackets function. You can only disable auto bracket closing altogether.

Some people suggest using the TabOut Extension for Visual Studio Code to tab out of quotes, brackets, etc.


Ok, so what I found out over at the VSC Github is this:

[...] This can be turned off via editor.autoClosingBrackets. The feature consists of multiple parts:

  • one is that when ( is typed, the result is (|).

  • the other part that is hit here, is that when ) is typed and ) follows the cursor, ) will be overtyped.

The feature is implemented language agnostic and looks only locally at the next character. It does not count brackets to determine if the code is "bracket unbalanced".

(Source: https://github.com/Microsoft/vscode/issues/35799)

At the moment, it's not possible to fix this, without losing the auto bracket closing feature. The above thread has since been closed. New one is here: https://github.com/Microsoft/vscode/issues/37315 , but no patch has come out yet.