mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Add support for macro in symbo_index
This commit is contained in:
parent
6fe956420f
commit
bb22a4e386
3 changed files with 20 additions and 12 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue