aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/completion/complete_keyword.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_analysis/src/completion/complete_keyword.rs')
-rw-r--r--crates/ra_analysis/src/completion/complete_keyword.rs64
1 files changed, 0 insertions, 64 deletions
diff --git a/crates/ra_analysis/src/completion/complete_keyword.rs b/crates/ra_analysis/src/completion/complete_keyword.rs
index dd81fc008..a381046e9 100644
--- a/crates/ra_analysis/src/completion/complete_keyword.rs
+++ b/crates/ra_analysis/src/completion/complete_keyword.rs
@@ -15,36 +15,6 @@ fn keyword(kw: &str, snippet: &str) -> CompletionItem {
15} 15}
16 16
17pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionContext) { 17pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionContext) {
18 // complete keyword "crate" in use stmt
19 match (ctx.use_item_syntax.as_ref(), ctx.path_prefix.as_ref()) {
20 (Some(_), None) => {
21 CompletionItem::new(CompletionKind::Keyword, "crate")
22 .kind(CompletionItemKind::Keyword)
23 .lookup_by("crate")
24 .snippet("crate::")
25 .add_to(acc);
26 CompletionItem::new(CompletionKind::Keyword, "self")
27 .kind(CompletionItemKind::Keyword)
28 .lookup_by("self")
29 .add_to(acc);
30 CompletionItem::new(CompletionKind::Keyword, "super")
31 .kind(CompletionItemKind::Keyword)
32 .lookup_by("super")
33 .add_to(acc);
34 }
35 (Some(_), Some(_)) => {
36 CompletionItem::new(CompletionKind::Keyword, "self")
37 .kind(CompletionItemKind::Keyword)
38 .lookup_by("self")
39 .add_to(acc);
40 CompletionItem::new(CompletionKind::Keyword, "super")
41 .kind(CompletionItemKind::Keyword)
42 .lookup_by("super")
43 .add_to(acc);
44 }
45 _ => {}
46 }
47
48 if !ctx.is_trivial_path { 18 if !ctx.is_trivial_path {
49 return; 19 return;
50 } 20 }
@@ -300,38 +270,4 @@ mod tests {
300 "#, 270 "#,
301 ) 271 )
302 } 272 }
303
304 #[test]
305 fn completes_keywords_in_use_stmt() {
306 check_keyword_completion(
307 r"
308 use <|>
309 ",
310 r#"
311 crate "crate" "crate::"
312 self "self"
313 super "super"
314 "#,
315 );
316
317 check_keyword_completion(
318 r"
319 use a::<|>
320 ",
321 r#"
322 self "self"
323 super "super"
324 "#,
325 );
326
327 check_keyword_completion(
328 r"
329 use a::{b, <|>}
330 ",
331 r#"
332 self "self"
333 super "super"
334 "#,
335 );
336 }
337} 273}