如何禁用彩色括号?

发布于 2025-01-17 19:30:17 字数 610 浏览 2 评论 0 原文

当我使用 VS Code 时,我会根据一天中的时间和房间的灯光配备浅色或深色主题。问题是,当我配备浅色主题时,

我发布了一张我的编辑器在配备浅色主题后的样子的图像来演示该问题。

我尝试了 BracketPairColorization.enable: "false" 如最底部的图像所示,但它不起作用。

有没有办法可以禁用为括号对着色的主题属性,或者设置禁用有效的彩色括号对?

输入图片描述这里


我已经检查了每个设置,甚至尝试了明显的设置,如下图所示,但我仍然无法弄清楚如何关闭括号配对颜色功能。

输入图像描述这里


如何完全禁用彩色括号?

When I use VS Code I equip either a light, or dark theme, depending on the time of day, and the lighting in the room. The problem is when I equip a light theme, the

I posted an image of what my editor looks like with my light theme equipped to demonstrate the issue.

I tried BracketPairColorization.enable: "false" as shown in the very bottom image, but it does not work.

Is there a way I can disable the theme-properties that color the bracket-pairs, or setting for disabling the colorized-bracket pairs that works?

enter image description here

I have inspected every settings, and even tried the obvious, as demonstrated in the image below, and figuring out how to turn off the bracketPairColorization feature still eludes me.

enter image description here

How do you completely disable the Colorized Brackets?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

花桑 2025-01-24 19:30:17

VS代码默认情况下启用了括号配色功能。这导致许多人寻求一种禁用该功能的方法,但是,故事还不简单地使用:

"editor.bracketPairColorization.enabled": false,

那是因为有2个不同的块指南功能,也是bracketpaircolorization功能的。作为缩进的指南功能,以相同的方式突出显示。

禁用所有支架对着色&指南,您需要执行以下操作。

{
    // Bracket-pair colorization
    "editor.bracketPairColorization.enabled": false, 

    // Bracket-pair guides
    "editor.guides.bracketPairsHorizontal": false,
    "editor.guides.highlightActiveBracketPair": false,

    // Indentation guides
    "editor.guides.indentation": false,
    "editor.guides.highlightActiveIndentation": false
}

要了解如何仅禁用该功能的一部分,或者一般而言此功能,请参阅以下各节介绍


配对


禁用/配置括号 & amp; Guides

vs Code的 '括号对颜色化' 功能使许多开发人员感到沮丧。最近,默认情况下它被激活了,人们对此感到不安。问题本身不是实际功能本身,而是该功能具有启用/禁用设置的事实,该设置在设置为禁用该功能时似乎不会关闭该功能。如果您试图关闭此功能,并且无法使自己无法生气或对自己感到不高兴(这是我在类似情况下所做的),那么大多数人都经历了同样的困难,此外;此功能并没有将其“沮丧的用户” 仅限于那些希望完全禁用它的人,事实是,该功能是高度可定制的,实际上包含大约3个不同的功能,对于试图首次配置它的任何人来说,很难有意义。

         最好的方法是演示您用来完全禁用该功能的配置。然后,之后,我将带您浏览每个设置,并解释它们的所作所为,以及它们也附加的主题属性。

第2部分


禁用支架配色& 下面的括号

对指南是“尝试 - & - true” 的方法,用于完整的残疾 bracketpaircolorization bracketpairColorization。指南& guidies.indentation 编辑器 - 特征(或者也许最好键入 编辑器。*功能” em>)。

{
    // Bracket-pair Highlighting
    "editor.bracketPairColorization.enabled": false, 

    // Bracket-pair guides
    "editor.guides.bracketPairsHorizontal": false,
    "editor.guides.highlightActiveBracketPair": false,

    // Indentation guides
    "editor.guides.indentation": false,
    "editor.guides.highlightActiveIndentation": false
}

part-3


禁用括号配色的部分,

如果功能的某些部分确实可以划分您的皮,但是您喜欢的其他部分,您可以指定某些渲染,着色和“ on Active and Active” “ - 使用下面显示的配置,将支架对和凹痕指南(水平&/或垂直)进行高光。

(3A)利用了真实的颜色的括号对设置

,我认为此功能所需的配置的复杂性是100%通过您可以处理的。尽管我不同意默认情况下激活它。

以下是括号配色可以完成的演示,这使其如此出色。如您所见,设置“ editor.language.colorizedbracketpairs”:[...] 正在下面的snippet中配置。阵列对波纹管是该功能将突出显示的括号对。换句话说,这就是如何定义突出显示哪些括号对。禁用括号对的颜色的一种方法是,只是不为 code> colorizedbracketpairs 设置分配任何对。您可以定义从功能括号到Markdown asseriks [“ ***”,“ ***”] 到C前处理器指令的所有内容。在这种情况下,世界是您的堡垒。

    "editor.language.colorizedBracketPairs": [
        ["{", "}"], // Block-Scoped Braces/Function-Braces
        ["[", "]"], // Array Square-brackets
        ["(", ")"], // Func Call-args/Declaration-params Brackets
        ["<", ">"], // HTML/XML Tags
        ["\"", "\""], // String Quotations
        ["_", "_"], // Markdown: Italicized
        ["**", "**"], // Markdown: Bold
        ["**_", "_**"], // Markdown: Italicized & Bold
        ["{{", "}}"], // Double Curly Brackets
        ["`", "`"], // Back-tics
        ["#ifndef", "#endif"], // Highlight C Directives as pairs
        ["<%", "%>"], // Wrapping variables in JSON
        ["${", "}"], // Wrapping template variables in JS/TS
        ["$(", ")"] // Wrapping of template variables in BASH
    ]

(3B)自定义凹痕指南

您还可以自定义“括号配色指南” &amp; “缩进指南” 通过在适用的情况下对true/false以外的其他值进行。

例如:例如
:下面的两个设置可以使用第三个布尔值偏置值配置:

以下配置,配置“支架对对指南” 仅突出显示活动的活动指南块,没有其他指南。

  "editor.guides.bracketPairs": "active",
  "editor.guides.bracketPairsHorizontal": "active",

现在,如果您如何将下面的设置配置为true,则不会执行任何操作,如果支架同时处于活动状态。

  "editor.guides.highlightActiveIndentation": false,

editor.guide.guide.highlightActiveIndentation 在上面的摘要中设置,是两对设置的一部分,用于自定义在括号内围绕括号之前很久以来vs代码的一部分。


注意:如果以下设置设置为 true ,并且如果您的“ editor.guide.guides.bracketpairs” 设置为 也是最终结果。您会看到缩进指南在不同级别上突出显示,因为支架对的工作方式与缩进指南不同。括号对指南试图突出显示使用语言定义的块,而缩进指南使用分配给“ tab.width”的值:number?来确定它将突出显示的位置。在许多情况下,这导致凹痕被两次突出。

  "editor.guides.indentation": true,
  "editor.guides.highlightActiveIndentation": true,

由于某种原因,他们制作了一个可以帮助您一次配置两者的设置,我不建议您,但这是“始终”分配给 “ ightlightiveActiveIndentation” 的值。如果您确实想用括号对打开它们,则下面显示您将如何做。

  "editor.guides.bracketPairs": "active",
  "editor.guides.bracketPairsHorizontal": "active",
  "editor.guides.indentation": true,
  "editor.guides.highlightActiveIndentation": "always",

您拥有的另一个选项是,您可以将“支架对指南”设置为true,然后配置它们以突出显示活动块,如:

  "editor.guides.bracketPairs": true,
  "editor.guides.bracketPairsHorizontal": true,
  "editor.guides.highlightActiveBracketPair": true,

第4部分


相关的主题颜色

,因此,如果我们查看最后一个摘要,在上方(我在下面再次发布)...

  "editor.guides.bracketPairs": true,
  "editor.guides.bracketPairsHorizontal": true,
  "editor.guides.highlightActiveBracketPair": true,

...您可以看到所有括号对已打开(以便它们有色),但有效的括号突出了。使用 settings.json 文件>“ workbench.colorcustomizations”:{}, 设置,括号对的标准着色在6个不同的块(或范围)级别上涂上不同的颜色。分配这些颜色的颜色属性如下:

    "editorBracketPairGuide.background1": "#CC1177",
    "editorBracketPairGuide.background2": "#5544DD",
    "editorBracketPairGuide.background3": "#CC6622",
    "editorBracketPairGuide.background4": "#779428",
    "editorBracketPairGuide.background5": "#009944",
    "editorBracketPairGuide.background6": "#1155DD",

现在,如果您具有 ightlightiveBracketPair 设置为 true ,那么您关注的块是更明亮的,或者是其他颜色(这取决于下面的属性如何配置),使用这些主题涂层的活动bracketpairguide是颜色的:

    "editorBracketPairGuide.activeBackground1": "#EE2288",
    "editorBracketPairGuide.activeBackground2": "#8844FF",
    "editorBracketPairGuide.activeBackground3": "#FF5C0C",
    "editorBracketPairGuide.activeBackground4": "#99CC33",
    "editorBracketPairGuide.activeBackground5": "#00CC88",
    "editorBracketPairGuide.activeBackground6": "#0077FF",

和实际的括号对(或实际的支架本身)使用这些属性进行了颜色:

    "editorBracketHighlight.foreground1": "#CC1177",
    "editorBracketHighlight.foreground2": "#5544DD",
    "editorBracketHighlight.foreground3": "#CC6622",
    "editorBracketHighlight.foreground4": "#779428",
    "editorBracketHighlight.foreground5": "#009944",
    "editorBracketHighlight.foreground6": "#1155DD",
    "editorBracketHighlight.unexpectedBracket.foreground": "#DD100C",
有关更多信息,请访问:

- &amp;/or-

VS Code has enabled the Bracket pair Colorization feature by default. This has caused many people to seek out a way to disable the feature, however there is a bit more to the story than simply using:

"editor.bracketPairColorization.enabled": false,

that is because there are 2 different block guide features that have been built-into the bracketPairColorization feature, as well as an indent-guide feature that highlights much the same way.

To disable all the bracket pair colorization & guides, you need to do the following.

{
    // Bracket-pair colorization
    "editor.bracketPairColorization.enabled": false, 

    // Bracket-pair guides
    "editor.guides.bracketPairsHorizontal": false,
    "editor.guides.highlightActiveBracketPair": false,

    // Indentation guides
    "editor.guides.indentation": false,
    "editor.guides.highlightActiveIndentation": false
}

TO LEARN HOW TO DISABLE ONLY PARTS OF THE FEATURE, OR MORE IN GENERAL ABOUT THIS FEATURE, REFER TO THE FOLLOWING SECTIONS


Intro


Disabling/Configuring Bracket Pair Colorization & Guides

V.S. Code's 'Bracket-pairs Colorization' feature frustrates many developers. Recently it was activated by default, and people were upset about it. The problem wasn't the actual feature itself, but the fact that the feature has an enable/disable setting that doesn't seem to turn the feature off when it is set to disable the feature. If you have tried to turn this feature off, and wound up unable to, do think get mad, or upset at yourself (which is what I do in similar situations), most have went through the same hardship, furthermore; this feature doesn't limit its "frustrating of users" to only those who desire to disable it altogether, the truth is, the feature is highly customizable, it actually includes about 3 different features wrapped into one, and is hard to make sense off for anyone attempting to configure it for the first time.

          The best way to do this is going to be to demonstrate the configuration that you use to completely disable the feature. Then, after that I will walk you through each setting, and explain what it is they do, and the theme properties they are attached too.

Part-2


Disabling Bracket-pair Colorization & Bracket-pair Guides

Below is a "tried -&- true" method for the complete disablement of the bracketPairColorization, bracketPairColorization.guides & guides.indentation editor-features (or perhaps it would be better to type "editor.* features").

{
    // Bracket-pair Highlighting
    "editor.bracketPairColorization.enabled": false, 

    // Bracket-pair guides
    "editor.guides.bracketPairsHorizontal": false,
    "editor.guides.highlightActiveBracketPair": false,

    // Indentation guides
    "editor.guides.indentation": false,
    "editor.guides.highlightActiveIndentation": false
}

Part-3


Disabling Parts of Bracket-pair Colorization

If there are parts of the feature that really chap your hide, but other parts that you like, you can specify the certain rendering, coloring, and "onActive"-highlighting of Bracket-pairs, and the indent guides (horizontal &/or vertical), using the configurations shown below.

(3a) Taking Advantage of the Colorized Bracket-pairs Setting

In truth, I feel the complexity of the configuration required for this feature is 100% justified by what you can do with it. Though I don't agree with it being activated by default.

Below is a demonstration of what can be done with Bracket-pair Colorization that makes it so awesome. As you can see, the setting "editor.language.colorizedBracketPairs": [ ... ] is being configured in the snippet below. The array pairs bellow are the bracket-pairs that the feature will highlight. In other words, this is how to define which bracket-pairs are highlighted. One way to disable the coloring of bracket pairs, is by simply not assigning any pairs to the colorizedBracketPairs setting. You can define everything from a functions braces, to markdown astriks ["***", "***"], to C Pre-processor directives. The world is your ostyer when it comes to this setting.

    "editor.language.colorizedBracketPairs": [
        ["{", "}"], // Block-Scoped Braces/Function-Braces
        ["[", "]"], // Array Square-brackets
        ["(", ")"], // Func Call-args/Declaration-params Brackets
        ["<", ">"], // HTML/XML Tags
        ["\"", "\""], // String Quotations
        ["_", "_"], // Markdown: Italicized
        ["**", "**"], // Markdown: Bold
        ["**_", "_**"], // Markdown: Italicized & Bold
        ["{{", "}}"], // Double Curly Brackets
        ["`", "`"], // Back-tics
        ["#ifndef", "#endif"], // Highlight C Directives as pairs
        ["<%", "%>"], // Wrapping variables in JSON
        ["${", "}"], // Wrapping template variables in JS/TS
        ["$(", ")"] // Wrapping of template variables in BASH
    ]

(3b) Customizing Indentation Guides

You can also customize "Bracket-pair Colorization Guides" & "Indent Guides" by asigning values other than true/false where applicable.

For example:
FOR EXAMPLE: The two settings below, can be configured using a third, boolean-alternate value:

The configuration below, configures the "bracket pair guides" to highlight only the active guides for the active block and no other guides.

  "editor.guides.bracketPairs": "active",
  "editor.guides.bracketPairsHorizontal": "active",

Now, if you how the setting below configured to true, it won't do anything, if bracketPairs are also active at the same time.

  "editor.guides.highlightActiveIndentation": false,

the editor.guides.highlightActiveIndentation setting in the snippet above, is part of a pair of settings used to customize a feature that was part of VS Code long before bracketPairs were around.


NOTE: If you have the settings below set to true, and if you have "editor.guides.bracketPairs" set to true as well, and over-highlighted editor is the end result. You will see indent guides highlighting at different levels, as the bracket pairs work differently than the indent guides. The bracket-pair guides try to highlight use language-defined blocks, while the indent guides use the value assigned to "tab.width": number? to determine where it will highlight. This causes indentation to be highlighted twice in many situations.

  "editor.guides.indentation": true,
  "editor.guides.highlightActiveIndentation": true,

For some reason they made a setting that helps you configure the two at once, I don't suggest it, but it's the value "always" assigned to "highlightActiveIndentation". If you did want to turn them on with bracket pairs, below shows how you would do it.

  "editor.guides.bracketPairs": "active",
  "editor.guides.bracketPairsHorizontal": "active",
  "editor.guides.indentation": true,
  "editor.guides.highlightActiveIndentation": "always",

Another option you have is you can set the "Bracket-pair guides" to true, then configure them to highlight the active block, like this:

  "editor.guides.bracketPairs": true,
  "editor.guides.bracketPairsHorizontal": true,
  "editor.guides.highlightActiveBracketPair": true,

Part-4


Associated Theme Colors

So if we look at the last snippet, just above (I'll post it again below)...

  "editor.guides.bracketPairs": true,
  "editor.guides.bracketPairsHorizontal": true,
  "editor.guides.highlightActiveBracketPair": true,

...you can see that all bracket pairs are turned on (so they are colored), but the active ones are highlighted. The way that this works is that in a theme, or in your settings.json file, using the "workbench.colorCustomizations": {}, setting, the standard coloring of the bracket-pairs are colored a different color at 6 different block (or scope) levels. The color properties to which those colors are assigned are shown below:

    "editorBracketPairGuide.background1": "#CC1177",
    "editorBracketPairGuide.background2": "#5544DD",
    "editorBracketPairGuide.background3": "#CC6622",
    "editorBracketPairGuide.background4": "#779428",
    "editorBracketPairGuide.background5": "#009944",
    "editorBracketPairGuide.background6": "#1155DD",

Now, if you have highlightActiveBracketPair set to true, then the block you focus on is brighter, or a different color (it depends on how the properties below are configured), the active bracketPairGuide is colored using these theme-properties:

    "editorBracketPairGuide.activeBackground1": "#EE2288",
    "editorBracketPairGuide.activeBackground2": "#8844FF",
    "editorBracketPairGuide.activeBackground3": "#FF5C0C",
    "editorBracketPairGuide.activeBackground4": "#99CC33",
    "editorBracketPairGuide.activeBackground5": "#00CC88",
    "editorBracketPairGuide.activeBackground6": "#0077FF",

And the actual bracket-pairs (or the actual brackets themselves) are colored using these properties:

    "editorBracketHighlight.foreground1": "#CC1177",
    "editorBracketHighlight.foreground2": "#5544DD",
    "editorBracketHighlight.foreground3": "#CC6622",
    "editorBracketHighlight.foreground4": "#779428",
    "editorBracketHighlight.foreground5": "#009944",
    "editorBracketHighlight.foreground6": "#1155DD",
    "editorBracketHighlight.unexpectedBracket.foreground": "#DD100C",
For more information visit:
https://code.visualstudio.com/blogs/2021/09/29/bracket-pair-colorization

-&/or-

https://code.visualstudio.com/updates/v1_60#_high-performance-bracket-pair-colorization
孤单情人 2025-01-24 19:30:17

tl; dr

您可以通过将以下内容添加到 settings.json 文件中删除此功能。

快捷方式:(类型 ctrl+shift+p ,单击打开设置(JSON)

"editor.language.colorizedBracketPairs": []

,或者,如果要设置特定的括号,则可以将它们传递到数组中

"editor.language.colorizedBracketPairs": [ ["{", "}"], ...]

TL;DR

You can remove this feature by adding the following to the settings.json file.

shortcut: (type ctrl+shift+p, click on Open Settings (JSON))

"editor.language.colorizedBracketPairs": []

or, if you'd like to set specific brackets you can pass them into the array

"editor.language.colorizedBracketPairs": [ ["{", "}"], ...]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文