Skip to content

feat(editor): richer JS/TS highlighting for JSDoc and methods - #2971

Merged
bajrangCoder merged 4 commits into
mainfrom
feat/jsdoc-highlighting
Oct 16, 2026
Merged

bajrangCoder merged 4 commits into
mainfrom
feat/jsdoc-highlighting

Conversation

@bajrangCoder

@bajrangCoder bajrangCoder commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Fixes JavaScript/TypeScript highlighting being flatter than in VS Code or Zed:

  • JSDoc comments (.js, .jsx, .ts, .tsx) were highlighted as a single comment token. Block tags (@param, @returns, …), {types}, parameter names and {@link} targets now get their own highlight tags, so themes can colour them separately.
  • Method calls (obj.method()), method definitions (constructor(), class/interface methods) and function declaration names were coloured like plain properties/variables in most built-in themes. They now use each theme's function colour.
  • In several built-in themes (Tomorrow Night, Tokyo Night, Dracula, Nord, Monokai, Catppuccin, GitHub, …) JS/TS properties such as this.foo had the same colour as method calls. JS/TS property names are now tagged memberProperty (a sub-tag of propertyName, so other themes are unaffected) and coloured like the themes' VS Code counterparts, without changing CSS properties, JSON/YAML keys or other languages.
  • Bumps @lezer/highlight to 1.2.5, which fixes context-specific highlight rules (needed for method definitions) being overridden by generic ones.

@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds richer JavaScript and TypeScript highlighting:

  • JSDoc comments show their tags, types, names, and links separately.
  • JavaScript methods and properties get colors that match their roles.

The three earlier, unnumbered findings are addressed: quoted strings skip escapes, optional defaults ignore quoted brackets, and tests cover JSDoc ranges and edits. No new actionable issues were found. Tests were inspected but not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["JS/TS language loader"] --> B["javascriptSupport"]
  B --> C["Method and property tags"]
  B --> D["jsdocWrap"]
  D --> E["JSDoc tags, types, names and links"]
  C --> F["Theme highlight styles"]
  E --> F
Loading

Reviews (3) · Last reviewed commit: "fix(themes): colour JS properties apart ..." · Reviewed by Greptile

Comment thread src/cm/modes/jsdoc/index.ts Outdated
Comment thread src/cm/modes/jsdoc/index.ts Outdated
Comment thread src/cm/modes/jsdoc/index.ts
…lighting

- 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.
@bajrangCoder bajrangCoder changed the title feat(editor): highlight JSDoc inside JS/TS block comments feat(editor): richer JS/TS highlighting for JSDoc and methods Oct 16, 2026
@bajrangCoder

This comment was marked as outdated.

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.
…g 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.
@bajrangCoder

This comment was marked as outdated.

@bajrangCoder
bajrangCoder added this pull request to the merge queue Oct 16, 2026
Merged via the queue into main with commit eb7cf40 Oct 16, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in The Code Board - Acode Oct 16, 2026
@bajrangCoder
bajrangCoder deleted the feat/jsdoc-highlighting branch October 16, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant