mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
9181: Don't complete values in type position r=jonas-schievink a=Veykril Will add some proper tests in a bit 9182: fix: don't complete derive macros as fn-like macros r=jonas-schievink a=jonas-schievink Part of https://github.com/rust-analyzer/rust-analyzer/issues/8518 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com> Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
commit
b6199de706
10 changed files with 219 additions and 59 deletions
|
@ -1351,6 +1351,13 @@ impl MacroDef {
|
|||
MacroDefKind::ProcMacro(_, base_db::ProcMacroKind::FuncLike, _) => MacroKind::ProcMacro,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_fn_like(&self) -> bool {
|
||||
match self.kind() {
|
||||
MacroKind::Declarative | MacroKind::BuiltIn | MacroKind::ProcMacro => true,
|
||||
MacroKind::Attr | MacroKind::Derive => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Invariant: `inner.as_assoc_item(db).is_some()`
|
||||
|
@ -2496,6 +2503,18 @@ impl ScopeDef {
|
|||
|
||||
items
|
||||
}
|
||||
|
||||
pub fn is_value_def(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
ScopeDef::ModuleDef(ModuleDef::Function(_))
|
||||
| ScopeDef::ModuleDef(ModuleDef::Variant(_))
|
||||
| ScopeDef::ModuleDef(ModuleDef::Const(_))
|
||||
| ScopeDef::ModuleDef(ModuleDef::Static(_))
|
||||
| ScopeDef::GenericParam(GenericParam::ConstParam(_))
|
||||
| ScopeDef::Local(_)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ItemInNs> for ScopeDef {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue