Use Salsa infrastructure for find-references and rename#1257
Open
lionel- wants to merge 7 commits into
Open
Conversation
11d6ce1 to
31b65be
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.
Branched from #1254
Progress towards #1212
Closes #1149
This PR moves find-references and rename onto the Salsa infra and deletes the old implementation (the textual workspace walk).
Candidate search: Unlike Rust-Analyzer that does a textual search across the workspace and resolves all occurrences, we're more aligned with ty: we filter files to inspect with a textual search, but then use a post-parse structure to filter occurrences. ty walks the AST, we walk the index instead with a new
uses_of()method that is more to the point than the raw AST.Candidates are then narrowed with
File::resolve_at()to check that they match the definition of the symbol at point.New supporting infra:
Identifier::classify()all_files()(Salsa query) that returns all files known to the databaseroot_by_file()that disambiguates to which workspace root a file belong when roots are nested. That is meant to be the one source of truth for root ownership of files.Removed infra: The
Documentcopies of the Rowan parse tree and semantic index are now removed, in favour of the Salsa DB.Other fix: Goto-definition now benefits from the new Salsa-based
Identifier::classify()which snaps the cursor to the symbol at point. Fixes goto-def when cursor in on RHS boundary.I recommend testing with #1259 to benefit from bug fixes and improvements in ulterior branches.