Highlight enclosing bracket in Visual Studio Code

2020-07-10 10:29发布

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.

2条回答
来,给爷笑一个
2楼-- · 2020-07-10 10:47

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.

查看更多
时光不老,我们不散
3楼-- · 2020-07-10 10:54

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.

查看更多
登录 后发表回答