Highlight enclosing bracket in Visual Studio Code

Also maybe you will like VSCode extension "Blockman", it highlights nested code blocks. (I am the author of Blockman)

VSCode Blockman intro


Yes, there is now a way by default, in VSCode 1.40 (October 2019):

Improvements to bracket matching

Previously, VS Code would only highlight matching brackets when the cursor was next to a bracket character.
Now VS Code will always highlight enclosing brackets if they exist.

Image showing highlighted enclosing brackets

We have also adjusted our Go to Bracket and Select to Bracket actions to use enclosing brackets.

It is improved and supported natively with VSCode 1.60 (Aug. 2021):

Bracket pair colorization can be enabled by setting "editor.bracketPairColorization.enabled": true.
All colors are themeable and up to six colors can be configured.

https://code.visualstudio.com/assets/updates/1_60/bracket-pair-colorization-checker_ts.gif


VS Code only supports bracket matching when the cursor is near the opening or closing bracket. Maybe an extension would help highlight the enclosing brackets wherever you are in the code but I haven't been able to find one.

If you just want to quickly find matching brackets, braces, parens, etc. you could try Bracket Pair Colorizer or Rainbow Brackets.


With release 1.60 (September 2021), VS Code now has bracket pair colorization built in, indicating all matching brackets by color.

This feature can be enabled by adding this line to settings.json:

"editor.bracketPairColorization.enabled": true

bracket pair colorization