mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Ignore proc-macro in completion
This commit is contained in:
parent
179d983535
commit
f78de3bb95
2 changed files with 17 additions and 0 deletions
|
@ -759,6 +759,17 @@ impl MacroDef {
|
|||
pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
|
||||
self.source(db).value.name().map(|it| it.as_name())
|
||||
}
|
||||
|
||||
/// Indicate it is a proc-macro
|
||||
pub fn is_proc_macro(&self) -> bool {
|
||||
match self.id.kind {
|
||||
hir_expand::MacroDefKind::Declarative => false,
|
||||
hir_expand::MacroDefKind::BuiltIn(_) => false,
|
||||
hir_expand::MacroDefKind::BuiltInDerive(_) => false,
|
||||
hir_expand::MacroDefKind::BuiltInEager(_) => false,
|
||||
hir_expand::MacroDefKind::CustomDerive(_) => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Invariant: `inner.as_assoc_item(db).is_some()`
|
||||
|
|
|
@ -156,6 +156,12 @@ impl Completions {
|
|||
name: Option<String>,
|
||||
macro_: hir::MacroDef,
|
||||
) {
|
||||
// FIXME: Currently proc-macro do not have ast-node,
|
||||
// such that it does not have source
|
||||
if macro_.is_proc_macro() {
|
||||
return;
|
||||
}
|
||||
|
||||
let name = match name {
|
||||
Some(it) => it,
|
||||
None => return,
|
||||
|
|
Loading…
Reference in a new issue