visual-studio-code

How to disable automatically adding a closing curly brace or bracket insertion in VS Code?


Is there a way to turn off automatically adding a closing curly brace in VS Code? I've gone through the editor settings one by one and turned off everything that was related to formatting, but there was nothing I saw specifically for this.

For example, when I type something like

function()
{

VS Code immediately adds } so that I end up with

function()
{}

Then, I press enter, and it has automatically indented the cursor. I don't want it to do any of that. I don't want it to auto insert any closing character or any indentations. I basically just want it to stop helping me and let me type the way I want to type. But I cannot figure out if there is any setting for this?


Solution

  • For new versions of vscode:

    Open Settings (Ctrl+, or ⌘+,), search for "autoClosingBrackets" and select "never" from the dropdown.

    Or, for users who prefer to configure the settings via text editor, open the settings file, settings.json and add:

    "editor.autoClosingBrackets": "never"
    

    You can also do this in a language-specific way by

    "[javascript]": {
        "editor.autoClosingBrackets": "never"
    }
    

    "always", "languageDefined", and "beforeWhitespace" are the new additional options.

    vscode curly braces settings


    [Previous, now inaccurate, setting.]

    // Controls if the editor should automatically close brackets after opening them

    "editor.autoClosingBrackets": false,