microsoft / microsoft/vscode

[Feature Request] Auto Closing Brackets with True Context-Aware Logic (Skip Whitespace/Newlines When Detecting Existing Closing Brackets)

Open
#333,793 0 comments 0 reactions 1 assignee Claimed by @hediet View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Description
VS Code's editor.autoClosingBrackets: "always" currently only checks the immediately next character for an existing closing bracket. It cannot skip whitespace, newlines, or any content in between.

For example, in this scenario:

json
{
"key": "value"
} ← existing closing brace
If I place my cursor before the } and type {, VS Code will still append another }, resulting in {}}.

IDEA/PyCharm/WebStorm handle this correctly — they scan ahead and detect the existing closing bracket even with whitespace/newlines in between.

Expected Behavior
When typing {, VS Code should scan ahead (skipping whitespace/newlines) to check for an existing unmatched }.
If found, do not auto-close.
Same logic for () and [].
Current Workaround
None of the existing settings fully solve this:

editor.autoClosingBrackets: "never" → Too manual, misses normal cases
editor.autoClosingBrackets: "beforeWhitespace" → Still not enough
bracketPairColorization.enabled: true → Only helps visually, not with closing bracket decision logic
Thank You
Would love to see this implemented natively. It's a small quality-of-life improvement that would make VS Code feel on par with JetBrains editors for JSON/config file editing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.