vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Incorrect brackets color in JSDoc comments

Open c-c-6ypo8 opened this issue 2 years ago • 3 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.80.0
  • OS Version: Windows 10 22H2 19045.3086

Steps to Reproduce:

  1. Change color of JSDoc comments' brackets in your theme file for scopes "punctuation.definition.bracket.curly.begin.jsdoc" and "punctuation.definition.bracket.curly.end.jsdoc".

  2. Reload window or restart editor. And you'll see no difference. Brackets's color is the same as for all the code. Theme JSDoc color doesn't affect global color, and it looks ugly.

  3. If you inspect colors by "Inspect Editor Tokens And Scopes" function, you'll see that inspector show the right color, but editor shows the global color as at the screenshot. Comment's brackets' color must be the same as "string" and "object" words' color as I made them the same in my theme:

{
      "name": "JSDoc Instance and brackets",
      "scope": [
        "entity.name.type.instance.jsdoc",
        "punctuation.definition.bracket.curly.begin.jsdoc",
        "punctuation.definition.bracket.curly.end.jsdoc",
      ],
      "settings": {
        "foreground": "#8e4a91"
      }
}

Screenshot

c-c-6ypo8 avatar Jul 07 '23 18:07 c-c-6ypo8

Looks like brackets pairs colorization get them. Could you try to disable it and check if theme overrides are applied correctly.

IllusionMH avatar Jul 07 '23 18:07 IllusionMH

Yes, it's true. If I disable this setting, theme works as expected, but there is no pair colorization in the code.

c-c-6ypo8 avatar Jul 07 '23 19:07 c-c-6ypo8

Yep, it was to clarify if that feature works in comments.

@hediet is it supposed to highlight pairs in comments and is there a way to control it?

/assign hediet -mjbvz

IllusionMH avatar Jul 07 '23 20:07 IllusionMH

~I guess an extension contributes a grammar for these tokens. This grammar can mark these tokens to ignore brackets in them.~

/**
 * @param {string} foo
 */
function foo() {

}

Happens with the default js grammar:

Code_-_Insiders_hRSSnpXqu9

If you feel strongly about it, we can exclude these tokens from bracket pair matching.

hediet avatar Jul 10 '23 08:07 hediet

It's not an extension! Bracket pair colorization is built-in!

c-c-6ypo8 avatar Jul 10 '23 08:07 c-c-6ypo8

If you feel strongly about it, we can exclude these tokens from bracket pair matching.

If you ask me, I think it's a good decision, because comments are not code, so there is no need of pair colorization in comments.

c-c-6ypo8 avatar Jul 10 '23 09:07 c-c-6ypo8

JSDoc is part of the code, especially if used as (partial) replacement for TS.

It would be nice to have default comment color for { } surrounding type, which should cover most of regular cases, but would be better to have highlights (not taking into account surrounding nesting level, so starting from scratch) for type value as it can use generics, types with nested objects and callback functions. For these cases would be nice to see from.

IllusionMH avatar Aug 21 '23 16:08 IllusionMH