Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-db/src/syntax_helpers/node_ext.rs')
-rw-r--r--crates/ide-db/src/syntax_helpers/node_ext.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ide-db/src/syntax_helpers/node_ext.rs b/crates/ide-db/src/syntax_helpers/node_ext.rs
index de8b4b367a..94ecf6a02d 100644
--- a/crates/ide-db/src/syntax_helpers/node_ext.rs
+++ b/crates/ide-db/src/syntax_helpers/node_ext.rs
@@ -1,6 +1,7 @@
//! Various helper functions to work with SyntaxNodes.
use std::ops::ControlFlow;
+use either::Either;
use itertools::Itertools;
use parser::T;
use span::Edition;
@@ -546,7 +547,11 @@ pub fn macro_call_for_string_token(string: &ast::String) -> Option<MacroCall> {
}
pub fn is_in_macro_matcher(token: &SyntaxToken) -> bool {
- let Some(macro_def) = token.parent_ancestors().find_map(ast::Macro::cast) else {
+ let Some(macro_def) = token
+ .parent_ancestors()
+ .map_while(Either::<ast::TokenTree, ast::Macro>::cast)
+ .find_map(Either::right)
+ else {
return false;
};
let range = token.text_range();