mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Add LifetimeParam and ConstParam to CompletionItemKind
This commit is contained in:
parent
f647e134a7
commit
83e49200d8
4 changed files with 34 additions and 24 deletions
|
@ -241,7 +241,7 @@ fn main() {
|
|||
check(
|
||||
r#"fn quux<const C: usize>() { $0 }"#,
|
||||
expect![[r#"
|
||||
tp C
|
||||
cp C
|
||||
fn quux() fn quux<const C: usize>()
|
||||
"#]],
|
||||
);
|
||||
|
|
|
@ -117,24 +117,26 @@ pub enum CompletionScore {
|
|||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum CompletionItemKind {
|
||||
Snippet,
|
||||
Keyword,
|
||||
Module,
|
||||
Function,
|
||||
Attribute,
|
||||
Binding,
|
||||
BuiltinType,
|
||||
Struct,
|
||||
Const,
|
||||
ConstParam,
|
||||
Enum,
|
||||
EnumVariant,
|
||||
Binding,
|
||||
Field,
|
||||
Function,
|
||||
Keyword,
|
||||
LifetimeParam,
|
||||
Macro,
|
||||
Method,
|
||||
Module,
|
||||
Snippet,
|
||||
Static,
|
||||
Const,
|
||||
Struct,
|
||||
Trait,
|
||||
TypeAlias,
|
||||
Method,
|
||||
TypeParam,
|
||||
Macro,
|
||||
Attribute,
|
||||
UnresolvedReference,
|
||||
}
|
||||
|
||||
|
@ -146,11 +148,13 @@ impl CompletionItemKind {
|
|||
CompletionItemKind::Binding => "bn",
|
||||
CompletionItemKind::BuiltinType => "bt",
|
||||
CompletionItemKind::Const => "ct",
|
||||
CompletionItemKind::ConstParam => "cp",
|
||||
CompletionItemKind::Enum => "en",
|
||||
CompletionItemKind::EnumVariant => "ev",
|
||||
CompletionItemKind::Field => "fd",
|
||||
CompletionItemKind::Function => "fn",
|
||||
CompletionItemKind::Keyword => "kw",
|
||||
CompletionItemKind::LifetimeParam => "lt",
|
||||
CompletionItemKind::Macro => "ma",
|
||||
CompletionItemKind::Method => "me",
|
||||
CompletionItemKind::Module => "md",
|
||||
|
|
|
@ -208,7 +208,11 @@ impl<'a> Render<'a> {
|
|||
ScopeDef::ModuleDef(Trait(..)) => CompletionItemKind::Trait,
|
||||
ScopeDef::ModuleDef(TypeAlias(..)) => CompletionItemKind::TypeAlias,
|
||||
ScopeDef::ModuleDef(BuiltinType(..)) => CompletionItemKind::BuiltinType,
|
||||
ScopeDef::GenericParam(..) => CompletionItemKind::TypeParam,
|
||||
ScopeDef::GenericParam(param) => match param {
|
||||
hir::GenericParam::TypeParam(_) => CompletionItemKind::TypeParam,
|
||||
hir::GenericParam::LifetimeParam(_) => CompletionItemKind::LifetimeParam,
|
||||
hir::GenericParam::ConstParam(_) => CompletionItemKind::ConstParam,
|
||||
},
|
||||
ScopeDef::Local(..) => CompletionItemKind::Binding,
|
||||
// (does this need its own kind?)
|
||||
ScopeDef::AdtSelfType(..) | ScopeDef::ImplSelfType(..) => CompletionItemKind::TypeParam,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue