diff options
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/completions/unqualified_path.rs | 2 | ||||
-rw-r--r-- | crates/completion/src/item.rs | 24 | ||||
-rw-r--r-- | crates/completion/src/render.rs | 6 |
3 files changed, 20 insertions, 12 deletions
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 809e1645a..860c774c1 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs | |||
@@ -241,7 +241,7 @@ fn main() { | |||
241 | check( | 241 | check( |
242 | r#"fn quux<const C: usize>() { $0 }"#, | 242 | r#"fn quux<const C: usize>() { $0 }"#, |
243 | expect![[r#" | 243 | expect![[r#" |
244 | tp C | 244 | cp C |
245 | fn quux() fn quux<const C: usize>() | 245 | fn quux() fn quux<const C: usize>() |
246 | "#]], | 246 | "#]], |
247 | ); | 247 | ); |
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index 4147853e7..ecf581be2 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs | |||
@@ -117,24 +117,26 @@ pub enum CompletionScore { | |||
117 | 117 | ||
118 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 118 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
119 | pub enum CompletionItemKind { | 119 | pub enum CompletionItemKind { |
120 | Snippet, | 120 | Attribute, |
121 | Keyword, | 121 | Binding, |
122 | Module, | ||
123 | Function, | ||
124 | BuiltinType, | 122 | BuiltinType, |
125 | Struct, | 123 | Const, |
124 | ConstParam, | ||
126 | Enum, | 125 | Enum, |
127 | EnumVariant, | 126 | EnumVariant, |
128 | Binding, | ||
129 | Field, | 127 | Field, |
128 | Function, | ||
129 | Keyword, | ||
130 | LifetimeParam, | ||
131 | Macro, | ||
132 | Method, | ||
133 | Module, | ||
134 | Snippet, | ||
130 | Static, | 135 | Static, |
131 | Const, | 136 | Struct, |
132 | Trait, | 137 | Trait, |
133 | TypeAlias, | 138 | TypeAlias, |
134 | Method, | ||
135 | TypeParam, | 139 | TypeParam, |
136 | Macro, | ||
137 | Attribute, | ||
138 | UnresolvedReference, | 140 | UnresolvedReference, |
139 | } | 141 | } |
140 | 142 | ||
@@ -146,11 +148,13 @@ impl CompletionItemKind { | |||
146 | CompletionItemKind::Binding => "bn", | 148 | CompletionItemKind::Binding => "bn", |
147 | CompletionItemKind::BuiltinType => "bt", | 149 | CompletionItemKind::BuiltinType => "bt", |
148 | CompletionItemKind::Const => "ct", | 150 | CompletionItemKind::Const => "ct", |
151 | CompletionItemKind::ConstParam => "cp", | ||
149 | CompletionItemKind::Enum => "en", | 152 | CompletionItemKind::Enum => "en", |
150 | CompletionItemKind::EnumVariant => "ev", | 153 | CompletionItemKind::EnumVariant => "ev", |
151 | CompletionItemKind::Field => "fd", | 154 | CompletionItemKind::Field => "fd", |
152 | CompletionItemKind::Function => "fn", | 155 | CompletionItemKind::Function => "fn", |
153 | CompletionItemKind::Keyword => "kw", | 156 | CompletionItemKind::Keyword => "kw", |
157 | CompletionItemKind::LifetimeParam => "lt", | ||
154 | CompletionItemKind::Macro => "ma", | 158 | CompletionItemKind::Macro => "ma", |
155 | CompletionItemKind::Method => "me", | 159 | CompletionItemKind::Method => "me", |
156 | CompletionItemKind::Module => "md", | 160 | CompletionItemKind::Module => "md", |
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs index 4f622d28a..68556c8ce 100644 --- a/crates/completion/src/render.rs +++ b/crates/completion/src/render.rs | |||
@@ -208,7 +208,11 @@ impl<'a> Render<'a> { | |||
208 | ScopeDef::ModuleDef(Trait(..)) => CompletionItemKind::Trait, | 208 | ScopeDef::ModuleDef(Trait(..)) => CompletionItemKind::Trait, |
209 | ScopeDef::ModuleDef(TypeAlias(..)) => CompletionItemKind::TypeAlias, | 209 | ScopeDef::ModuleDef(TypeAlias(..)) => CompletionItemKind::TypeAlias, |
210 | ScopeDef::ModuleDef(BuiltinType(..)) => CompletionItemKind::BuiltinType, | 210 | ScopeDef::ModuleDef(BuiltinType(..)) => CompletionItemKind::BuiltinType, |
211 | ScopeDef::GenericParam(..) => CompletionItemKind::TypeParam, | 211 | ScopeDef::GenericParam(param) => match param { |
212 | hir::GenericParam::TypeParam(_) => CompletionItemKind::TypeParam, | ||
213 | hir::GenericParam::LifetimeParam(_) => CompletionItemKind::LifetimeParam, | ||
214 | hir::GenericParam::ConstParam(_) => CompletionItemKind::ConstParam, | ||
215 | }, | ||
212 | ScopeDef::Local(..) => CompletionItemKind::Binding, | 216 | ScopeDef::Local(..) => CompletionItemKind::Binding, |
213 | // (does this need its own kind?) | 217 | // (does this need its own kind?) |
214 | ScopeDef::AdtSelfType(..) | ScopeDef::ImplSelfType(..) => CompletionItemKind::TypeParam, | 218 | ScopeDef::AdtSelfType(..) | ScopeDef::ImplSelfType(..) => CompletionItemKind::TypeParam, |