Highlight enclosing bracket in Visual Studio Code

Viewed 14207

Is there a way to highlight brackets when the cursor is anywhere within the enclosing brackets? Default settings highlight it only when I place the cursor near the brackets.

5 Answers

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

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

VSCode Blockman intro

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

I am using Version: 1.63.2(MacOS). Default bracket highlight feature was not working for me. In case, someone face similar issue, set it true.

"editor.matchBrackets": true,
Related