Add find references feature to goto service#2209
Draft
soutaro wants to merge 3 commits into
Draft
Conversation
b22859c to
339131e
Compare
…bol name Add $/steep/resolve_symbol custom LSP method. The interaction worker receives a textDocument position, resolves it to query objects via GotoService#resolve_references_queries, and returns them serialized as JSON. Add as_json/from_json/query_from_json for query serialization. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add $/steep/references/search custom LSP method. Typecheck workers receive a symbol name, search assigned files via GotoService#find_references, and return location links. Add reference search methods: constant_references_in_ruby, method_references_in_ruby, type_name_references_in_rbs. Extract locations_to_links helper in TypeCheckWorker. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Orchestrate two-phase find references: send ResolveSymbol to the interaction worker to resolve the cursor position, then broadcast References__Search to all typecheck workers and merge results. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
339131e to
c7ec6bc
Compare
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
This PR implements a "find references" feature for the Steep language server, allowing users to find all references to constants, methods, and type names across Ruby and RBS files.
Key Changes
GotoService enhancements:
as_jsonandfrom_jsonmethods toConstantQuery,MethodQuery, andTypeNameQueryfor serializationquery_from_jsonfactory method to deserialize query objectsreferencesmethod to find all references to a symbol with optional declaration inclusionresolve_references_queries,find_references,constant_references_in_ruby,method_references_in_ruby, andtype_name_references_in_rbsLanguage Server Protocol support:
references_provider: trueto server capabilities inmaster.rbtextDocument/referencesrequest handler with two-phase resolution:Worker implementations:
InteractionWorker: AddedReferencesQueryJobandprocess_references_queryto resolve references queries at a given positionTypeCheckWorker: AddedReferencesJobandreferencesmethod to search for references across type-checked filesCustom methods:
References__QueryResolutionandReferences__Searchcustom LSP methods for the two-phase reference finding workflowTests:
Implementation Details
The feature uses a two-phase approach:
References are found in both Ruby source files (via typing information) and RBS signature files (via RBS index queries).
https://claude.ai/code/session_016jjaePV7QxhdjsytmUE3Sw