aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r--crates/ide_completion/src/completions/keyword.rs43
-rw-r--r--crates/ide_completion/src/completions/snippet.rs2
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs48
3 files changed, 1 insertions, 92 deletions
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs
index 7970e75c7..0a3df79d4 100644
--- a/crates/ide_completion/src/completions/keyword.rs
+++ b/crates/ide_completion/src/completions/keyword.rs
@@ -350,49 +350,6 @@ fn quux() -> i32 {
350 } 350 }
351 351
352 #[test] 352 #[test]
353 fn test_keywords_in_trait_def() {
354 check(
355 r"trait My { $0 }",
356 expect![[r#"
357 kw unsafe
358 kw fn
359 kw const
360 kw type
361 "#]],
362 );
363 }
364
365 #[test]
366 fn test_keywords_in_impl_def() {
367 check(
368 r"impl My { $0 }",
369 expect![[r#"
370 kw pub(crate)
371 kw pub
372 kw unsafe
373 kw fn
374 kw const
375 kw type
376 "#]],
377 );
378 }
379
380 #[test]
381 fn test_keywords_in_impl_def_with_attr() {
382 check(
383 r"impl My { #[foo] $0 }",
384 expect![[r#"
385 kw pub(crate)
386 kw pub
387 kw unsafe
388 kw fn
389 kw const
390 kw type
391 "#]],
392 );
393 }
394
395 #[test]
396 fn test_keywords_in_loop() { 353 fn test_keywords_in_loop() {
397 check( 354 check(
398 r"fn my() { loop { $0 } }", 355 r"fn my() { loop { $0 } }",
diff --git a/crates/ide_completion/src/completions/snippet.rs b/crates/ide_completion/src/completions/snippet.rs
index 4e64a0090..d142265e0 100644
--- a/crates/ide_completion/src/completions/snippet.rs
+++ b/crates/ide_completion/src/completions/snippet.rs
@@ -36,7 +36,7 @@ pub(crate) fn complete_expr_snippet(acc: &mut Completions, ctx: &CompletionConte
36} 36}
37 37
38pub(crate) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionContext) { 38pub(crate) fn complete_item_snippet(acc: &mut Completions, ctx: &CompletionContext) {
39 if !ctx.expects_item() || ctx.previous_token_is(T![unsafe]) { 39 if !ctx.expects_item() || ctx.previous_token_is(T![unsafe]) || ctx.path_qual().is_some() {
40 return; 40 return;
41 } 41 }
42 if ctx.has_visibility_prev_sibling() { 42 if ctx.has_visibility_prev_sibling() {
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index 2c623bf7a..3910de2c4 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -500,18 +500,6 @@ fn f() {$0}
500 check( 500 check(
501 r#" 501 r#"
502#[rustc_builtin_macro] 502#[rustc_builtin_macro]
503pub macro Clone {}
504
505struct S;
506impl S {
507 $0
508}
509"#,
510 expect![[r#""#]],
511 );
512 check(
513 r#"
514#[rustc_builtin_macro]
515pub macro bench {} 503pub macro bench {}
516 504
517fn f() {$0} 505fn f() {$0}
@@ -773,42 +761,6 @@ impl My$0
773 } 761 }
774 762
775 #[test] 763 #[test]
776 fn completes_in_assoc_item_list() {
777 check(
778 r#"
779macro_rules! foo {}
780mod bar {}
781
782struct MyStruct {}
783impl MyStruct {
784 $0
785}
786"#,
787 expect![[r#"
788 md bar
789 ma foo!(…) macro_rules! foo
790 "#]],
791 )
792 }
793
794 #[test]
795 fn completes_in_item_list() {
796 check(
797 r#"
798struct MyStruct {}
799macro_rules! foo {}
800mod bar {}
801
802$0
803"#,
804 expect![[r#"
805 md bar
806 ma foo!(…) macro_rules! foo
807 "#]],
808 )
809 }
810
811 #[test]
812 fn completes_types_and_const_in_arg_list() { 764 fn completes_types_and_const_in_arg_list() {
813 check( 765 check(
814 r#" 766 r#"