181

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?

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
sstchur
  • 1,883
  • 2
  • 9
  • 10
  • 45
    Not Alone, too often this has created bugs in my code. – BaneStar007 Apr 01 '19 at 23:16
  • 3
    Related: [Visual Studio Code disable auto-quote](https://stackoverflow.com/q/48714304/4975230), for those of you that are looking to disable all of the automatic behavior. – jrh Jun 04 '19 at 16:23
  • 3
    thank you for posting this question. I really like VSCode, but I can not understand a world where a development studio has "do things for you features" that are so hard to figure out how to turn off. How about authors of IDEs start adding "auto stop doing things for me" modes? – David Jeske Sep 22 '20 at 03:39
  • They have to throw the kitchen sink against the wall and see what gets hailed as innovation. Some things work great (multiple cursors) and other things are useless bling (minimap). 25 years ago we used IDEs without intellisense, autocompile, and even color coding. – John Churchill Mar 25 '21 at 16:13
  • 6
    Annoying as hell, I also disabled the auto-closing quotes and HTML tags `"editor.autoClosingQuotes": "never", "html.autoClosingTags": false` – Paranoid Android Apr 28 '21 at 12:34
  • "I'm probably the only person in the word " -> With the advent of tools like Copilot, I think you may not be as alone as you think on this regard. thanks for asking this question. – Felipe Valdes Feb 27 '22 at 15:15
  • @DavidJeske as a busy developer, I find that the "do things for you" features save me valuable time. I don't have to ensure there are no missing closures, and I don't have to format code manually. If there's any feature that annoys me, it's easy enough to turn off or adjust. – ADTC Dec 20 '22 at 05:18
  • Guys, shortly, it will not only auto-close brackets but also auto-complete your code, write your code, and fire you :) – nosbor Mar 05 '23 at 16:17

2 Answers2

181

For new versions of vscode:

"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,
mit
  • 11,083
  • 11
  • 50
  • 74
Mark
  • 143,421
  • 24
  • 428
  • 436
  • 1
    Thanks! This is great -- not sure how I missed it. I swear I went through the file line by line. Guess I wasn't as careful as I thought. Now... is there a way to disable auto indentation as well? After typing an opening curly brace and hitting enter, it auto indents for me. This is annoying b/c I hit tab by habit and then I end up with two tabs. – sstchur Sep 29 '17 at 15:38
  • 3
    Is there anything for parentheses? I can't find it. – Petruza Apr 23 '19 at 19:09
  • When I change the value to `"never"` (new options added later than the original answer - see above) I do not get parentheses automatically closed. Try `"never"` instead of `"false"`. – Mark Apr 23 '19 at 19:24
  • 14
    If you disabled these settings, it's likely you'll also want to set `editor.autoSurround` to `"never"`. – Charles_F Sep 26 '19 at 19:10
  • 3
    I was expecting a settings page like in Visual Studio. Where do you type this? – hannodb Sep 22 '20 at 12:06
  • 1
    On Mac (it's what I have) you open the Preferences panel Then you enter "autocomplete" on the box to search settings Then you will find (I'm working with Python) Python>Autocomplete blah Then you click the "Edit in settings.json" – AlexD Nov 14 '20 at 20:51
  • shouldn't the first line of this answer be edited? What's the point of having the old, deprecated `false` be the first visible thing? I downvote until this is fixed. – Cornelius Roemer Sep 08 '21 at 15:35
  • @CorneliusRoemer I re-worked the answer. Thanks. – Mark Sep 08 '21 at 19:57
  • @mark thanks! I changed it to an upvote :) – Cornelius Roemer Sep 08 '21 at 22:20
  • @Mark is there any way to temporarily disable these with a keyboard shortcut or keyboard modifier? I don't want to disable it permanently using the preference, but just do so temporarily for one instance every now and then. – ADTC Dec 20 '22 at 05:19
  • Thanks @Charles_F, that's the one I was looking for! – arvymetal Feb 28 '23 at 20:29
  • For anyone looking, you type this in this file: `.vscode\settings.json`. If you don't have this file yet, create it, and type `{` and `}`. You paste the content above between those curly brackets. Formatting with some newlines and tabs is off course allowed as in any json file. – Stefan Aug 08 '23 at 15:26
4

Settings -> lookup "brackets" -> Editor: Auto Closing Brackets -> Never

lubosdz
  • 4,210
  • 2
  • 29
  • 43