Vscode: "editor.autoClosingBrackets" granularity

Created on 14 Oct 2017  ·  8Comments  ·  Source: microsoft/vscode

  • VSCode Version: Code 1.17.1 (1e9d36539b0ae51ac09b9d4673ebea4e447e5353, 2017-10-10T14:24:50.851Z)
  • OS Version: Windows_NT x64 10.0.15063
  • Extensions:

Extension|Author (truncated)|Version
---|---|---
vscode-add-nativescript-files|ale|1.0.1
vscode-svgviewer|css|1.4.3
xml|Dot|1.9.2
auto-close-tag|for|0.5.1
mssql|ms-|1.2.0
csharp|ms-|1.12.1
vs-keybindings|ms-|0.1.7
vetur|oct|0.9.11
material-icon-theme|PKi|2.2.2
vscode-icons|rob|7.15.0
code-settings-sync|Sha|2.8.3
nativescript|Tel|0.7.2


"editor.autoClosingBrackets" disables all closing "things" (as parenthesis, quotes, brackets, etc.).
It would be nice if those settings were by type: editor.autoClosingQuotes, editor.autoClosingParenthesis and editor.autoClosingBrackets.
Also, it would be a LOT helpful if braces were inserted only after typing enter (and no immediatly after typing "{")

Steps to Reproduce:

  1. Edit settings and set "editor.autoClosingBrackets": false
  2. Only brackets should be disabled for autoClosing (as quotes are not brackets, nor are parenthesis)

Reproduces without extensions: Yes

editor-autoclosing feature-request on-testplan

Most helpful comment

What I'd like to see is an option to turn off auto-closing when text is selected. Auto-closing quotes or brackets works very well for me, except when I have text selected, where I want to replace the selected text with ONLY what I typed.

All 8 comments

I have always found Code's handling of auto-closing quotes deeply unintuitive and annoying to the point where I just can't use it for any serious amount of programming. Auto-closing brackets OTOH is completely fine, and disabling it just to get rid of the annoying quote behavior is a pity, too. So 💯👍 to a dedicated editor.autoClosingQuotes setting.

What I'd like to see is an option to turn off auto-closing when text is selected. Auto-closing quotes or brackets works very well for me, except when I have text selected, where I want to replace the selected text with ONLY what I typed.

The closing brackets (_provided some small fixes_) would be a very nice feature to have enabled, but the "magic" _quotes_ just kills me! Doesn't work _at all_ with my way of editing (maybe it's to old-school, but it's efficient - I do not work very linearly, preemptive could be the word). I keep fighting the editor. All in all, I gain more from disabling it, despite that the parens-help probably would be a boost.

I would be sooooo happy to see the settings separated!

I totally agree with @slimCODE .
I do think we need a separate option for this. I mean, the only key I don't want to INPUT it when I press is the TAB key. for all other keys, I just want to INPUT them, and if there's any selection, just replace the selection.

I can't paste in YML without every line being wrapped by quotes. I hate that, but auto bracket closing is not something I want to give up.

I always quote my strings from the back to front (I read backwards sometimes), and the autoquoting ruins my code. I also need the autobracketing though, so please implement this as a granular option.

If nothing else, being able to disable quotes alone could help those with dyslexia.

Big +1 on this one – auto quotes never behave how I expect and usually generate a weird mash of ' at the end of the line when I'm trying to change quote types.

I'd love the ability to disable auto-quotes while keeping auto-brackets.

In the latest Insiders you'll find two new settings, and a change in the inputs accepted for the existing setting:

  // Controls whether the editor should automatically close brackets after the user adds an opening bracket.
  //  - always
  //  - languageDefined: Use language configurations to determine when to autoclose brackets.
  //  - beforeWhitespace: Autoclose brackets only when the cursor is to the left of whitespace.
  //  - never
  "editor.autoClosingBrackets": "languageDefined",

  // Controls whether the editor should automatically close quotes the user adds an opening quote.
  //  - always
  //  - languageDefined: Use language configurations to determine when to autoclose quotes.
  //  - beforeWhitespace: Autoclose quotes only when the cursor is to the left of whitespace.
  //  - never
  "editor.autoClosingQuotes": "languageDefined",

  // Controls whether the editor should automatically wrap selections.
  //  - always
  //  - brackets: Wrap with brackets but not quotes.
  //  - quotes: Wrap with quotes but not brackets.
  //  - never
  "editor.autoWrapping": "always",

Note that these will all be overridden by editor.autoClosingBrackets if it is set to false, so be sure to update that to use the new schema.

Was this page helpful?
0 / 5 - 0 ratings