简体   繁体   English

"在 Visual Studio Code 中突出显示括号"

[英]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 ColorizerRainbow Brackets

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 and Select to Bracket actions to use enclosing brackets.我们还调整了Go to BracketSelect 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的作者)

VSCode Blockman 简介

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM