From bb22a4e386c13a17b518a3822d343f6dd3dc4398 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 22 Mar 2020 15:00:44 +0800 Subject: Add support for macro in symbo_index --- crates/ra_syntax/src/ast/extensions.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index c3ae8f90e..392731dac 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs @@ -4,7 +4,7 @@ use itertools::Itertools; use crate::{ - ast::{self, child_opt, children, AstNode, AttrInput, SyntaxNode}, + ast::{self, child_opt, children, AstNode, AttrInput, NameOwner, SyntaxNode}, SmolStr, SyntaxElement, SyntaxKind::*, SyntaxToken, T, @@ -514,3 +514,14 @@ impl ast::Visibility { self.syntax().children_with_tokens().any(|it| it.kind() == T![super]) } } + +impl ast::MacroCall { + pub fn is_macro_rules(&self) -> Option { + let name_ref = self.path()?.segment()?.name_ref()?; + if name_ref.text() == "macro_rules" { + self.name() + } else { + None + } + } +} -- cgit v1.2.3