aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2020-04-18 12:26:35 +0100
committerEdwin Cheng <[email protected]>2020-04-18 12:26:54 +0100
commitf78de3bb95acb996102a74b5b12d33054ba6d4c4 (patch)
tree3219fe0b36e333c39cb7720ba35ee31046454557 /crates/ra_hir
parent179d9835351f3abab03634b50bcee94723cce148 (diff)
Ignore proc-macro in completion
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/code_model.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 3801fce23..6e0d89466 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -759,6 +759,17 @@ impl MacroDef {
759 pub fn name(self, db: &dyn HirDatabase) -> Option<Name> { 759 pub fn name(self, db: &dyn HirDatabase) -> Option<Name> {
760 self.source(db).value.name().map(|it| it.as_name()) 760 self.source(db).value.name().map(|it| it.as_name())
761 } 761 }
762
763 /// Indicate it is a proc-macro
764 pub fn is_proc_macro(&self) -> bool {
765 match self.id.kind {
766 hir_expand::MacroDefKind::Declarative => false,
767 hir_expand::MacroDefKind::BuiltIn(_) => false,
768 hir_expand::MacroDefKind::BuiltInDerive(_) => false,
769 hir_expand::MacroDefKind::BuiltInEager(_) => false,
770 hir_expand::MacroDefKind::CustomDerive(_) => true,
771 }
772 }
762} 773}
763 774
764/// Invariant: `inner.as_assoc_item(db).is_some()` 775/// Invariant: `inner.as_assoc_item(db).is_some()`