fix(parsers): compile JS highlights and add Dart highlights so modifiers and decorators populate - #779
Conversation
…ers and decorators populate
There was a problem hiding this comment.
Code Review
This pull request introduces fallback tree-sitter highlights for Dart and fixes an issue where TypeScript-only modifiers in javascript.scm caused the concatenated highlights query to fail compiling silently. It also adds corresponding tests to verify modifier and decorator extraction for JS and Dart, and ensures all supported languages load a highlights query. The review feedback suggests adding the const modifier to the Dart highlights query and refactoring the language-loading test to iterate over sorted parsers for deterministic execution and complete coverage.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Greptile SummaryThis PR fixes highlight-query coverage for JavaScript and Dart. The main changes are:
Confidence Score: 5/5Safe to merge with minimal risk. The change is scoped to highlight query definitions, Dart wrapper handling in the existing extraction flow, and targeted regression tests. No blocking or non-blocking issues were identified. No files require special attention.
What T-Rex did
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Loader as load_parsers/_create_highlights_query
participant SCM as queries/highlights/*.scm
participant Extractor as extract_modifiers_and_decorators
participant Node as Function/Class AST node
Loader->>SCM: Load package HIGHLIGHTS_QUERY plus fallback SCM
SCM-->>Loader: Compiled highlights Query for JS/Dart
Node->>Extractor: Function/method/class node
Extractor->>Extractor: Promote Dart function_signature to method_signature
Extractor->>Extractor: Include preceding decorator/annotation siblings
Extractor-->>Node: modifiers and decorators lists
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Loader as load_parsers/_create_highlights_query
participant SCM as queries/highlights/*.scm
participant Extractor as extract_modifiers_and_decorators
participant Node as Function/Class AST node
Loader->>SCM: Load package HIGHLIGHTS_QUERY plus fallback SCM
SCM-->>Loader: Compiled highlights Query for JS/Dart
Node->>Extractor: Function/method/class node
Extractor->>Extractor: Promote Dart function_signature to method_signature
Extractor->>Extractor: Include preceding decorator/annotation siblings
Extractor-->>Node: modifiers and decorators lists
Reviews (2): Last reviewed commit: "fix(parsers): capture dart const and fin..." | Re-trigger Greptile |
|
@greptile review |
…-dart # Conflicts: # uv.lock
|



Closes #525.
What was actually missing
The modifier/decorator extraction pipeline this issue asks for already exists end to end:
_create_highlights_queryloads a highlights query per language (pip packageHIGHLIGHTS_QUERYplus aqueries/highlights/*.scmfallback),extract_modifiers_and_decoratorsturns@keyword.modifierand@attribute/@function.decoratorcaptures into themodifiersanddecoratorsnode properties, and function/method/class ingestion attaches them. What remained were two silent per-language holes:javascript.scmlisted TypeScript-only tokens (public,private,protected,readonly,abstract,declare,override) that are not node kinds in the JS grammar. One invalid token makes the whole concatenated query fail to compile, and the loader degrades toNonewith only a startup debug log, so JS lost decorators and its real modifiers (static,async, ...) too.HIGHLIGHTS_QUERYand no fallback file existed. Dart also needed two shape rules in the generic walk: a class member'sstatictoken belongs to themethod_signaturewrapper (not the capturedfunction_signature), and@override-style metadata precedes the signature as siblingannotationnodes.Fix
javascript.scmtrimmed to JS-valid tokens (async,export,default,static,get,set) plus(decorator).dart.scm(annotations +static/final/abstract/late/external/covariant/get/set).extract_modifiers_and_decoratorspromotes a Dartfunction_signatureto its wrappingmethod_signatureand collects precedingannotationsiblings.Tests (RED first)
test_every_language_loads_a_highlights_query— the loud regression gate: a highlights query that fails to compile can no longer degrade silently for months.test_js_method_modifiers_and_decorators_captured—static/async/@decon a JS class method.test_dart_annotations_and_modifiers_captured—static/@overrideon a Dart class method.With this, all 12 supported languages (plus TSX) load a compiling highlights query and populate the
modifiers/decoratorsproperties, which completes the remaining open sub-issue of #521 (#523 already delivered scope tracking).