diff options
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide/src/ssr.rs | 6 |
2 files changed, 6 insertions, 3 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 | } |
diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs index ca7e0ad86..3e2705d62 100644 --- a/crates/ra_ide/src/ssr.rs +++ b/crates/ra_ide/src/ssr.rs | |||
@@ -1,3 +1,4 @@ | |||
1 | use ra_db::FilePosition; | ||
1 | use ra_ide_db::RootDatabase; | 2 | use ra_ide_db::RootDatabase; |
2 | 3 | ||
3 | use crate::SourceFileEdit; | 4 | use crate::SourceFileEdit; |
@@ -42,12 +43,13 @@ pub fn parse_search_replace( | |||
42 | rule: &str, | 43 | rule: &str, |
43 | parse_only: bool, | 44 | parse_only: bool, |
44 | db: &RootDatabase, | 45 | db: &RootDatabase, |
46 | position: FilePosition, | ||
45 | ) -> Result<Vec<SourceFileEdit>, SsrError> { | 47 | ) -> Result<Vec<SourceFileEdit>, SsrError> { |
46 | let rule: SsrRule = rule.parse()?; | 48 | let rule: SsrRule = rule.parse()?; |
49 | let mut match_finder = MatchFinder::in_context(db, position); | ||
50 | match_finder.add_rule(rule); | ||
47 | if parse_only { | 51 | if parse_only { |
48 | return Ok(Vec::new()); | 52 | return Ok(Vec::new()); |
49 | } | 53 | } |
50 | let mut match_finder = MatchFinder::new(db); | ||
51 | match_finder.add_rule(rule); | ||
52 | Ok(match_finder.edits()) | 54 | Ok(match_finder.edits()) |
53 | } | 55 | } |