Search code examples
visual-studio-codehighlighttext-editor

How to prefer highlighting inner parenthesizes instead of outer?


Visual Studio Code automatically highlights the outer parenthesizes as show as in this picture:

enter image description here

How can I change it to highlight the inner parenthesizes like this as seen in Notepad++:

enter image description here


Solution

  • Bracket pair colorization will be built-in to vscode 1.60.

    1. enable Editor > Bracket Pair Colorization: Enabled
    2. Select some colors for the bracket pairs in your settings:
    {
        "workbench.colorCustomizations": {
    
          "editorBracketHighlight.foreground1": "#ff00d4",
          "editorBracketHighlight.foreground2": "#66ff00",
          "editorBracketHighlight.foreground3": "#ffd000",  // up to 6
          
          "editorBracketHighlight.unexpectedBracket.foreground": "#ff0000"
        }
    }
    

    That will highlight both of the bracket pairs you showed in your example. If you didn't want, for example, the outer pair colored just don't assign a color to that bracket pair. In your case, probably pair 2 if enclosed in some outer function.


    The highlighting of the brackets you referred to is something else. If you click inside the inner pair then those brackets would be highlighted. Think of them as the focussed brackets. That color is controlled by:

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