aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/semantics.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index 827e23e2b..d522d5245 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -17,7 +17,7 @@ use rustc_hash::{FxHashMap, FxHashSet};
17use syntax::{ 17use syntax::{
18 algo::find_node_at_offset, 18 algo::find_node_at_offset,
19 ast::{self, GenericParamsOwner, LoopBodyOwner}, 19 ast::{self, GenericParamsOwner, LoopBodyOwner},
20 match_ast, AstNode, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextSize, 20 match_ast, AstNode, SyntaxNode, SyntaxNodePtr, SyntaxToken, TextRange, TextSize,
21}; 21};
22 22
23use crate::{ 23use crate::{
@@ -395,7 +395,15 @@ impl<'db> SemanticsImpl<'db> {
395 match node { 395 match node {
396 ast::MacroCall(macro_call) => { 396 ast::MacroCall(macro_call) => {
397 let tt = macro_call.token_tree()?; 397 let tt = macro_call.token_tree()?;
398 if !tt.syntax().text_range().contains_range(token.value.text_range()) { 398 let l_delim = match tt.left_delimiter_token() {
399 Some(it) => it.text_range().end(),
400 None => tt.syntax().text_range().start()
401 };
402 let r_delim = match tt.right_delimiter_token() {
403 Some(it) => it.text_range().start(),
404 None => tt.syntax().text_range().end()
405 };
406 if !TextRange::new(l_delim, r_delim).contains_range(token.value.text_range()) {
399 return None; 407 return None;
400 } 408 }
401 let file_id = sa.expand(self.db, token.with_value(&macro_call))?; 409 let file_id = sa.expand(self.db, token.with_value(&macro_call))?;