feat: add Phase 5 document highlights provider - #244
Merged
Conversation
Phase 5 — tree-sitter-backed DocumentHighlightProvider: highlight all occurrences of the symbol at the cursor. Message::DocumentHighlights { uri, line, column } -> DocumentHighlightsResponse { highlights: [{ range, kind }] } or null. Resolve the identifier at the position, then recursively walk the document AST collecting ALL identifier-like nodes whose text matches; kind heuristic: declaration name (is_declaration_name) -> Write(2), otherwise Read(1). File-local only.
Refactor: extracted point_for_position helper (shared Point resolution between hover and find_identifier_at_position); unified response interfaces to use IRange.
Fix: corrected DocumentHighlightKind comment (Text=0, not Text=3 — VS Code enum, not LSP). No runtime impact (only Read=1/Write=2 are emitted).
Known limitation (documented): file-local, name-based — no cross-file type resolution, no scope-aware filtering. Coexists with the built-in TS provider (non-exclusive, Phase 1 pattern).
Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 5 of the native (Rust) Language Host: tree-sitter-backed DocumentHighlightProvider, continuing Phase 0→1→2→3→4 (documentSymbol/foldingRange/hover/definition/references already merged).
Phase 5 — Document Highlights
Message::DocumentHighlights { uri, line, column }→DocumentHighlightsResponse { highlights: [{ range, kind }] }ornullDocumentHighlight { range, kind }wherekindisWrite(2) for declaration names (is_declaration_name) andRead(1) otherwise.Text(0) is unused in v1.Refactor
point_for_positionhelper (shared Point resolution between hover andfind_identifier_at_position)IRangeFix
Corrected
DocumentHighlightKindcomment (Text=0, notText=3— VS Code enum, not LSP). No runtime impact (onlyRead=1/Write=2are emitted).Known limitation
File-local, name-based — no cross-file type resolution like tsserver, no scope-aware filtering. Coexists with the built-in TS provider (non-exclusive, Phase 1 pattern).
How to verify