diff options
Diffstat (limited to 'crates/ra_ide/src/ssr.rs')
-rw-r--r-- | crates/ra_ide/src/ssr.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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 | } |