本文介绍了Visual Studio Code 中的自定义大括号突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Visual Studio Code 中自定义大括号突出显示?似乎其他所有内容都可以通过用户和工作区设置以及 textmate 主题进行自定义.无论您使用哪种语法突出显示,大括号周围始终具有相同的浅灰色轮廓/矩形.我没有看到解决此特定功能的现有用户/工作区设置或 textmate 范围.

Is it possible to customize the brace highlighting in Visual Studio Code? It seems just about everything else is customizable through user and workspace settings, as well as textmate themes. Regardless of the syntax highlighting you employ, the braces always have the same light gray outline/rectangle around them. I don't see an existing user/workspace setting or a textmate scope that addresses this specific feature.

最终,我想要匹配大括号的纯色高亮显示,类似于您在 Visual Studio 2013 和 2015 中使用默认深色主题获得的效果.

Ultimately I'd like to have a solid color highlight of matching braces, similar to what you would get with the default dark theme in Visual Studio 2013 and 2015.

推荐答案

为了将来参考,vscode 现在可以选择通过将其添加到 settings.json 来更改括号突出显示的颜色:>

For future reference, vscode now has the option to change the color of bracket highlighting by adding this to settings.json:

"workbench.colorCustomizations" : {
        "editorBracketMatch.background": "#f008",
        "editorBracketMatch.border": "#f00"
}

支持的格式有 #RGB#RGBA#RRGGBB#RRGGBBAA.rgba(255,255,255,1) 格式在设置文件的其他地方似乎有效,但在这里似乎无效.

Formats supported are #RGB, #RGBA, #RRGGBB, #RRGGBBAA. The rgba(255,255,255,1) format that seems to work in other places in the settings file appears to not work here.

更新 2018.04.21现在有一个名为 Bracket Pair Colorizer 的插件可以显示除了行号之外的当前括号,无论光标放在刹车内的哪个位置.但是在较慢的硬件(第 3 代 i5 笔记本电脑)上,我在编辑大文件(3000 多行 php 文件)时遇到了速度变慢的情况.在同一文件上表现良好并突出显示当前缩进的替代插件是 Guides.

Update 2018.04.21There is now a plugin called Bracket Pair Colorizer that does shows the current brackets besides the line number no matter where the cursor is placed within the brakes. But on slower hardware (3nd generation i5 laptop) i encountered slowdowns with it when editing large files (3000+ line php file). And alternate plugin that performs well on the same file and highlights the current indentation is Guides.

更新 2019.11.10VSCode 1.40 现在突出显示包围光标的括号.

Update 2019.11.10VSCode 1.40 now highlights the brackets enclosing the cursor.

2021.08.09 更新正如@desilicius 在评论中提到的 Bracket Pair colorizer 不再由作者维护.他提供了替代Blockman - 突出显示嵌套代码块,它具有相同的功能但具有完全不同的外观和 突出显示匹配标签一个很棒的插件,但顾名思义,它只适用于 html(和 jsx)标签.

Update 2021.08.09as @desilicius mentioned in the comments Bracket Pair colorizer is no longer maintained by the author. He offers as an alternative Blockman - Highlight Nested Code Blocks which has the same functionality but has a totally different look and Highlight Matching Tag which is a great plugin but only works on html (and jsx) tags as the name implies.

2021.08.13 更新VSCode 团队决定添加括号对着色作为内置功能.它现在正在工作,改进了 10k x BPC2 的速度.可以在此处

Update 2021.08.13The VSCode team decided to add bracket pair colorization as a built in feature. It is worked on right now with improvements of 10k x the speed of BPC2. The discussion can be found here

这篇关于Visual Studio Code 中的自定义大括号突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 20:11
查看更多