aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/lib.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-24 13:46:55 +0100
committerGitHub <[email protected]>2020-07-24 13:46:55 +0100
commitc3defe2532ba6ffd12a13bcbc8fdeda037665efc (patch)
tree831bf4dd44ec83d927face4ba17e57dcdeab7fbe /crates/ra_ide/src/lib.rs
parent0e5095d3cac11d4b569c6e1594bd07937556c812 (diff)
parent58680cb08ea535e1fb567416fa3466a744a01b99 (diff)
Merge #5518
5518: Use resolved paths in SSR rules r=matklad a=davidlattimore The main user-visible changes are: * SSR now matches paths based on whether they resolve to the same thing instead of whether they're written the same. * So `foo()` won't match `foo()` if it's a different function `foo()`, but will match `bar::foo()` if it's the same `foo`. * Paths in the replacement will now be rendered with appropriate qualification for their context. * For example `foo::Bar` will render as just `Bar` inside the module `foo`, but might render as `baz::foo::Bar` from elsewhere. * This means that all paths in the search pattern and replacement template must be able to be resolved. * It now also matters where you invoke SSR from, since paths are resolved relative to wherever that is. * Search now uses find-uses on paths to locate places to try matching. This means that when a path is present in the pattern, search will generally be pretty fast. * Function calls can now match method calls again, but this time only if they resolve to the same function. Co-authored-by: David Lattimore <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/lib.rs')
-rw-r--r--crates/ra_ide/src/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index dc9192d42..7356e947b 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -505,9 +505,10 @@ impl Analysis {
505 &self, 505 &self,
506 query: &str, 506 query: &str,
507 parse_only: bool, 507 parse_only: bool,
508 position: FilePosition,
508 ) -> Cancelable<Result<SourceChange, SsrError>> { 509 ) -> Cancelable<Result<SourceChange, SsrError>> {
509 self.with_db(|db| { 510 self.with_db(|db| {
510 let edits = ssr::parse_search_replace(query, parse_only, db)?; 511 let edits = ssr::parse_search_replace(query, parse_only, db, position)?;
511 Ok(SourceChange::from(edits)) 512 Ok(SourceChange::from(edits))
512 }) 513 })
513 } 514 }