[英]Highlight enclosing bracket in Visual Studio Code
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.
只有当我将光标放在括号附近时,默认设置才会突出显示它。
VS Code only supports bracket matching when the cursor is near the opening or closing bracket. VS Code 仅在光标位于左括号或右括号附近时才支持括号匹配。 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 .如果您只想快速找到匹配的括号、大括号、括号等,您可以尝试Bracket Pair Colorizer或Rainbow Brackets 。
With release 1.60 (September 2021)<\/a> , VS Code now has bracket pair colorization built in, indicating all matching brackets by color.在
1.60(2021 年 9 月)版本<\/a>中,VS Code 现在内置了括号对着色,以颜色指示所有匹配的括号。
This feature can be enabled by adding this line to settings.json:可以通过将此行添加到 settings.json 来启用此功能:
"editor.bracketPairColorization.enabled": true
Yes, there is now a way by default, in VSCode 1.40 (October 2019) :是的,现在默认有一种方法, 在 VSCode 1.40(2019 年 10 月)中:
Improvements to bracket matching
括号匹配的改进
Previously, VS Code would only highlight matching brackets when the cursor was next to a bracket character.
以前,当光标位于括号字符旁边时,VS Code 只会突出显示匹配的括号。
Now VS Code will always highlight enclosing brackets if they exist .现在 VS Code 将始终突出显示封闭括号(如果存在) 。
We have also adjusted our
Go to Bracket
andSelect to Bracket
actions to use enclosing brackets.我们还调整了
Go to Bracket
和Select to Bracket
操作以使用封闭括号。
I am using Version: 1.63.2(MacOS).我正在使用版本:1.63.2(MacOS)。 Default bracket highlight feature was not working for me.
默认括号突出显示功能对我不起作用。 In case, someone face similar issue, set it true.
如果有人遇到类似问题,请将其设置为 true。
"editor.matchBrackets": true,
Also maybe you will like VSCode extension "Blockman", it highlights nested code blocks.另外,也许你会喜欢 VSCode 扩展“Blockman”,它突出了嵌套的代码块。 (I am the author of Blockman)
(我是Blockman的作者)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.