Incorrect brackets color in JSDoc 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:
-
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".
-
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.
-
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"
}
}
Looks like brackets pairs colorization get them. Could you try to disable it and check if theme overrides are applied correctly.
Yes, it's true. If I disable this setting, theme works as expected, but there is no pair colorization in the code.
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
~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:
If you feel strongly about it, we can exclude these tokens from bracket pair matching.
It's not an extension! Bracket pair colorization is built-in!
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.
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.