From 3975952601888d9f77e466c12e8e389748984b33 Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Wed, 22 Jul 2020 15:00:28 +1000 Subject: SSR: Pass current file position through to SSR code. In a subsequent commit, it will be used for resolving paths. --- crates/ra_ide/src/ssr.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide/src/ssr.rs') 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 @@ +use ra_db::FilePosition; use ra_ide_db::RootDatabase; use crate::SourceFileEdit; @@ -42,12 +43,13 @@ pub fn parse_search_replace( rule: &str, parse_only: bool, db: &RootDatabase, + position: FilePosition, ) -> Result, SsrError> { let rule: SsrRule = rule.parse()?; + let mut match_finder = MatchFinder::in_context(db, position); + match_finder.add_rule(rule); if parse_only { return Ok(Vec::new()); } - let mut match_finder = MatchFinder::new(db); - match_finder.add_rule(rule); Ok(match_finder.edits()) } -- cgit v1.2.3