aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ssr/src/search.rs
diff options
context:
space:
mode:
authorDavid Lattimore <[email protected]>2020-07-22 07:46:29 +0100
committerDavid Lattimore <[email protected]>2020-07-24 12:34:00 +0100
commit757f755c29e041fd319af466d7d0418f54cb090a (patch)
tree30d94206c5009730855a2ceaebdf364963358928 /crates/ra_ssr/src/search.rs
parent3975952601888d9f77e466c12e8e389748984b33 (diff)
SSR: Match paths based on what they resolve to
Also render template paths appropriately for their context.
Diffstat (limited to 'crates/ra_ssr/src/search.rs')
-rw-r--r--crates/ra_ssr/src/search.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_ssr/src/search.rs b/crates/ra_ssr/src/search.rs
index a28e9f341..ccc2d544a 100644
--- a/crates/ra_ssr/src/search.rs
+++ b/crates/ra_ssr/src/search.rs
@@ -1,6 +1,6 @@
1//! Searching for matches. 1//! Searching for matches.
2 2
3use crate::{matching, parsing::ParsedRule, Match, MatchFinder}; 3use crate::{matching, resolving::ResolvedRule, Match, MatchFinder};
4use ra_db::FileRange; 4use ra_db::FileRange;
5use ra_syntax::{ast, AstNode, SyntaxNode}; 5use ra_syntax::{ast, AstNode, SyntaxNode};
6 6
@@ -8,13 +8,13 @@ impl<'db> MatchFinder<'db> {
8 /// Adds all matches for `rule` to `matches_out`. Matches may overlap in ways that make 8 /// Adds all matches for `rule` to `matches_out`. Matches may overlap in ways that make
9 /// replacement impossible, so further processing is required in order to properly nest matches 9 /// replacement impossible, so further processing is required in order to properly nest matches
10 /// and remove overlapping matches. This is done in the `nesting` module. 10 /// and remove overlapping matches. This is done in the `nesting` module.
11 pub(crate) fn find_matches_for_rule(&self, rule: &ParsedRule, matches_out: &mut Vec<Match>) { 11 pub(crate) fn find_matches_for_rule(&self, rule: &ResolvedRule, matches_out: &mut Vec<Match>) {
12 // FIXME: Use resolved paths in the pattern to find places to search instead of always 12 // FIXME: Use resolved paths in the pattern to find places to search instead of always
13 // scanning every node. 13 // scanning every node.
14 self.slow_scan(rule, matches_out); 14 self.slow_scan(rule, matches_out);
15 } 15 }
16 16
17 fn slow_scan(&self, rule: &ParsedRule, matches_out: &mut Vec<Match>) { 17 fn slow_scan(&self, rule: &ResolvedRule, matches_out: &mut Vec<Match>) {
18 use ra_db::SourceDatabaseExt; 18 use ra_db::SourceDatabaseExt;
19 use ra_ide_db::symbol_index::SymbolsDatabase; 19 use ra_ide_db::symbol_index::SymbolsDatabase;
20 for &root in self.sema.db.local_roots().iter() { 20 for &root in self.sema.db.local_roots().iter() {
@@ -30,7 +30,7 @@ impl<'db> MatchFinder<'db> {
30 fn slow_scan_node( 30 fn slow_scan_node(
31 &self, 31 &self,
32 code: &SyntaxNode, 32 code: &SyntaxNode,
33 rule: &ParsedRule, 33 rule: &ResolvedRule,
34 restrict_range: &Option<FileRange>, 34 restrict_range: &Option<FileRange>,
35 matches_out: &mut Vec<Match>, 35 matches_out: &mut Vec<Match>,
36 ) { 36 ) {