zed icon indicating copy to clipboard operation
zed copied to clipboard

Add JSDoc scope

Open chbk opened this issue 7 months ago • 3 comments

This is a small PR that adds a .jsdoc scope to JSDoc tokens, just like JSX has a specific scope. This effectively allows differentiating between JavaScript keywords and JSDoc tags in comments.

Release Notes:

  • Add scope for JSDoc

chbk avatar Apr 26 '25 12:04 chbk

These cases don't really seem to be the same.

In the JSX case we differentiate the selectors because they are within the JavaScript language.

But in the JSDoc case we have a whole separate language, so it doesn't seem like we would then need to additionally tag them within that language.

maxdeviant avatar Apr 28 '25 21:04 maxdeviant

Ultimately JSDoc is injected into JavaScript, so a scope should be added to differentiate "keywords" in both contexts. This would allow highlighting @todo comments differently from actual keywords like if, while etc. Another alternative would be creating a scope like comment.emphasis

chbk avatar Apr 29 '25 13:04 chbk

@maxdeviant I see there is a documented comment.doc scope. Would that fit here?

chbk avatar May 20 '25 17:05 chbk