aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ssr/src/matching.rs
diff options
context:
space:
mode:
authorDavid Lattimore <[email protected]>2020-06-30 06:55:20 +0100
committerDavid Lattimore <[email protected]>2020-07-01 07:50:45 +0100
commit95f8310514238fc2c3b4d1ddecbd1b79d2c963a2 (patch)
treefae3a79e0597e8d26bbb2d7e1200ecfa594e082b /crates/ra_ssr/src/matching.rs
parentb1a2d016450c96581c9cc70cc464f8aab2e5c0f3 (diff)
Structured search debugging
Diffstat (limited to 'crates/ra_ssr/src/matching.rs')
-rw-r--r--crates/ra_ssr/src/matching.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs
index 54413a151..53d802e77 100644
--- a/crates/ra_ssr/src/matching.rs
+++ b/crates/ra_ssr/src/matching.rs
@@ -8,9 +8,7 @@ use crate::{
8use hir::Semantics; 8use hir::Semantics;
9use ra_db::FileRange; 9use ra_db::FileRange;
10use ra_syntax::ast::{AstNode, AstToken}; 10use ra_syntax::ast::{AstNode, AstToken};
11use ra_syntax::{ 11use ra_syntax::{ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken};
12 ast, SyntaxElement, SyntaxElementChildren, SyntaxKind, SyntaxNode, SyntaxToken, TextRange,
13};
14use rustc_hash::FxHashMap; 12use rustc_hash::FxHashMap;
15use std::{cell::Cell, iter::Peekable}; 13use std::{cell::Cell, iter::Peekable};
16 14
@@ -44,8 +42,8 @@ macro_rules! fail_match {
44 42
45/// Information about a match that was found. 43/// Information about a match that was found.
46#[derive(Debug)] 44#[derive(Debug)]
47pub(crate) struct Match { 45pub struct Match {
48 pub(crate) range: TextRange, 46 pub(crate) range: FileRange,
49 pub(crate) matched_node: SyntaxNode, 47 pub(crate) matched_node: SyntaxNode,
50 pub(crate) placeholder_values: FxHashMap<Var, PlaceholderMatch>, 48 pub(crate) placeholder_values: FxHashMap<Var, PlaceholderMatch>,
51 pub(crate) ignored_comments: Vec<ast::Comment>, 49 pub(crate) ignored_comments: Vec<ast::Comment>,
@@ -135,7 +133,7 @@ impl<'db, 'sema> MatchState<'db, 'sema> {
135 match_state.attempt_match_node(&match_inputs, &pattern_tree, code)?; 133 match_state.attempt_match_node(&match_inputs, &pattern_tree, code)?;
136 match_state.validate_range(&sema.original_range(code))?; 134 match_state.validate_range(&sema.original_range(code))?;
137 match_state.match_out = Some(Match { 135 match_state.match_out = Some(Match {
138 range: sema.original_range(code).range, 136 range: sema.original_range(code),
139 matched_node: code.clone(), 137 matched_node: code.clone(),
140 placeholder_values: FxHashMap::default(), 138 placeholder_values: FxHashMap::default(),
141 ignored_comments: Vec::new(), 139 ignored_comments: Vec::new(),