diff options
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 29 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 2 |
2 files changed, 30 insertions, 1 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 515a6285c..38a6c3d37 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -310,6 +310,35 @@ mod tests { | |||
310 | } | 310 | } |
311 | 311 | ||
312 | #[test] | 312 | #[test] |
313 | fn completes_self_in_enum() { | ||
314 | assert_debug_snapshot!( | ||
315 | do_reference_completion( | ||
316 | r" | ||
317 | enum X { | ||
318 | Y(<|>) | ||
319 | } | ||
320 | " | ||
321 | ), | ||
322 | @r###"[ | ||
323 | CompletionItem { | ||
324 | label: "Self", | ||
325 | source_range: [48; 48), | ||
326 | delete: [48; 48), | ||
327 | insert: "Self", | ||
328 | kind: TypeParam, | ||
329 | }, | ||
330 | CompletionItem { | ||
331 | label: "X", | ||
332 | source_range: [48; 48), | ||
333 | delete: [48; 48), | ||
334 | insert: "X", | ||
335 | kind: Enum, | ||
336 | }, | ||
337 | ]"### | ||
338 | ); | ||
339 | } | ||
340 | |||
341 | #[test] | ||
313 | fn completes_module_items() { | 342 | fn completes_module_items() { |
314 | assert_debug_snapshot!( | 343 | assert_debug_snapshot!( |
315 | do_reference_completion( | 344 | do_reference_completion( |
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 48028a2f9..eb480a775 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -72,7 +72,7 @@ impl Completions { | |||
72 | } | 72 | } |
73 | ScopeDef::GenericParam(..) => (CompletionItemKind::TypeParam, None), | 73 | ScopeDef::GenericParam(..) => (CompletionItemKind::TypeParam, None), |
74 | ScopeDef::LocalBinding(..) => (CompletionItemKind::Binding, None), | 74 | ScopeDef::LocalBinding(..) => (CompletionItemKind::Binding, None), |
75 | ScopeDef::SelfType(..) => ( | 75 | ScopeDef::AdtSelfType(..) | ScopeDef::ImplSelfType(..) => ( |
76 | CompletionItemKind::TypeParam, // (does this need its own kind?) | 76 | CompletionItemKind::TypeParam, // (does this need its own kind?) |
77 | None, | 77 | None, |
78 | ), | 78 | ), |