Add support for macro in symbo_index
This commit is contained in:
@@ -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<ast::Name> {
|
||||
let name_ref = self.path()?.segment()?.name_ref()?;
|
||||
if name_ref.text() == "macro_rules" {
|
||||
self.name()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user