SSR: Pass current file position through to SSR code.

In a subsequent commit, it will be used for resolving paths.
This commit is contained in:
David Lattimore
2020-07-22 15:00:28 +10:00
parent 02fc3d50ee
commit 3975952601
11 changed files with 88 additions and 32 deletions

View File

@@ -7,7 +7,7 @@ pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
use ra_db::SourceDatabaseExt;
let (host, vfs) = load_cargo(&std::env::current_dir()?, true, true)?;
let db = host.raw_database();
let mut match_finder = MatchFinder::new(db);
let mut match_finder = MatchFinder::at_first_file(db)?;
for rule in rules {
match_finder.add_rule(rule);
}
@@ -30,7 +30,7 @@ pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<Stri
use ra_ide_db::symbol_index::SymbolsDatabase;
let (host, _vfs) = load_cargo(&std::env::current_dir()?, true, true)?;
let db = host.raw_database();
let mut match_finder = MatchFinder::new(db);
let mut match_finder = MatchFinder::at_first_file(db)?;
for pattern in patterns {
match_finder.add_search_pattern(pattern);
}