aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-06-09 17:02:31 +0100
committerLukas Wirth <[email protected]>2021-06-09 17:27:08 +0100
commitae8d74ab2caed66dc84f64f6859bdf3f131388e1 (patch)
treee2cd48d719266092d8a87810ec385c9caeae5c2d /crates/ide_completion
parent5f592f4f58a6e1e1db0f920af34a2f569b65017c (diff)
Implement dummy expansions for builtin attributes
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/qualified_path.rs26
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs12
2 files changed, 32 insertions, 6 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index 0b0a81410..58d4dd9ee 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -657,6 +657,32 @@ fn main() { let _ = crate::$0 }
657 } 657 }
658 658
659 #[test] 659 #[test]
660 fn does_not_complete_non_fn_macros() {
661 check(
662 r#"
663mod m {
664 #[rustc_builtin_macro]
665 pub macro Clone {}
666}
667
668fn f() {m::$0}
669"#,
670 expect![[r#""#]],
671 );
672 check(
673 r#"
674mod m {
675 #[rustc_builtin_macro]
676 pub macro bench {}
677}
678
679fn f() {m::$0}
680"#,
681 expect![[r#""#]],
682 );
683 }
684
685 #[test]
660 fn completes_in_assoc_item_list() { 686 fn completes_in_assoc_item_list() {
661 check( 687 check(
662 r#" 688 r#"
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index 1f6c4069f..b1e6b2b77 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -481,14 +481,14 @@ impl S {
481 ); 481 );
482 check( 482 check(
483 r#" 483 r#"
484mod m { 484#[rustc_builtin_macro]
485 #[rustc_builtin_macro] 485pub macro bench {}
486 pub macro Clone {}
487}
488 486
489fn f() {m::$0} 487fn f() {$0}
490"#, 488"#,
491 expect![[r#""#]], 489 expect![[r#"
490 fn f() fn()
491 "#]],
492 ); 492 );
493 } 493 }
494 494