Repository navigation
Commit eb7cf40
authored
feat(editor): richer JS/TS highlighting for JSDoc and methods (#2971)
* feat(editor): highlight JSDoc inside JS/TS block comments
* feat(editor): colour JS/TS methods as functions and refine JSDoc highlighting
- Tag class and interface method names as function definitions and give
method calls, method definitions and function declaration names the
function colour in all built-in themes.
- Bump @lezer/highlight to 1.2.5, which fixes the precedence of
context-specific highlight rules added through parser props.
- Leave JSDoc braces and punctuation as comment text, handle escaped
quotes in types and quoted brackets in optional defaults, and skip
/*** comments like TypeScript does.
- Add unit tests for JSDoc and method highlighting.
* fix(themes): colour properties differently from methods
Themes that reused the function colour for properties made this.foo look
like a method call. Give properties the palette's property colour where it
has one (Tokyo Night, Catppuccin) and the foreground otherwise, and stop
colouring Noctis Lilac property definitions as functions.
* fix(themes): colour JS properties apart from methods without affecting other languages
propertyName is shared by CSS properties, JSON/YAML keys, Go/C++ fields and
(through attributeName) HTML attributes, so giving it its own colour moved
those away from how VS Code colours them. Restore the themes' propertyName
colour and tag JS/TS property names with memberProperty, a sub-tag of
propertyName that falls back to it in themes that don't style it. Built-in
themes colour it like their VS Code counterparts.1 parent a8dae47 commit eb7cf40
28 files changed
Lines changed: 954 additions & 29 deletions
File tree
- src/cm
- modes
- javascript
- jsdoc
- themes
- tests/unit
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
| 163 | + | |
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
0 commit comments