feat: add Phase 4 references provider - #243
Merged
Merged
Conversation
Phase 4 — tree-sitter-backed ReferenceProvider (Find All References, Shift+F12): Message::References { uri, line, column, include_declaration } -> DefinitionResponse { locations: Location[] } or null. Resolve the identifier at the position, then recursively walk the document AST collecting ALL identifier-like nodes whose text matches; declaration name nodes (parent is_definition_declaration_kind, node is its name field) are gated by include_declaration (VS Code ReferenceContext). File-local only; all matches returned.
Fix: Message::References was missing per-variant rename_all = "camelCase", so include_declaration expected snake_case while the renderer sent camelCase includeDeclaration — every references request failed to deserialize and timed out. Added the attribute (same serde trap as Phase 2).
Refactor: extracted find_identifier_at_position (shared prelude between definition and references), unified parseDefinition/parseReferences into parseLocations, flattened the declaration-gating condition.
Known limitation (documented): 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).
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 4 of the native (Rust) Language Host: tree-sitter-backed ReferenceProvider (Find All References, Shift+F12), continuing Phase 0→1→2→3 (documentSymbol/foldingRange/hover/definition already merged).
Phase 4 — References
Message::References { uri, line, column, include_declaration }→DefinitionResponse { locations: Location[] }ornullinclude_declaration(VS CodeReferenceContext)Fix
Message::Referenceswas missing per-variantrename_all = "camelCase", soinclude_declarationexpected snake_case while the renderer sent camelCaseincludeDeclaration— every references request failed to deserialize and timed out. Added the attribute (same serde trap as Phase 2).Refactor
find_identifier_at_position(shared prelude between definition and references)parseDefinition/parseReferencesintoparseLocationscollect_reference_locationsKnown limitation
File-local, name-based — no cross-file type resolution like tsserver, no scope-aware filtering (shadowed locals match too). Coexists with the built-in TS provider (non-exclusive, Phase 1 pattern).
How to verify
Verified end-to-end by the user (Shift+F12).