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/qualified_path.rs30
-rw-r--r--crates/ide_completion/src/completions/unqualified_path.rs22
2 files changed, 52 insertions, 0 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index d58745fb4..a5cba5938 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -199,6 +199,36 @@ mod tests {
199 } 199 }
200 200
201 #[test] 201 #[test]
202 fn dont_complete_values_in_type_pos() {
203 check(
204 r#"
205const FOO: () = ();
206static BAR: () = ();
207struct Baz;
208fn foo() {
209 let _: self::$0;
210}
211"#,
212 expect![[r#"
213 st Baz
214 "#]],
215 );
216 }
217
218 #[test]
219 fn dont_complete_enum_variants_in_type_pos() {
220 check(
221 r#"
222enum Foo { Bar }
223fn foo() {
224 let _: Foo::$0;
225}
226"#,
227 expect![[r#""#]],
228 );
229 }
230
231 #[test]
202 fn dont_complete_current_use_in_braces_with_glob() { 232 fn dont_complete_current_use_in_braces_with_glob() {
203 check( 233 check(
204 r#" 234 r#"
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs
index f370dbdf0..2105bb428 100644
--- a/crates/ide_completion/src/completions/unqualified_path.rs
+++ b/crates/ide_completion/src/completions/unqualified_path.rs
@@ -69,6 +69,28 @@ mod tests {
69 } 69 }
70 70
71 #[test] 71 #[test]
72 fn dont_complete_values_in_type_pos() {
73 check(
74 r#"
75const FOO: () = ();
76static BAR: () = ();
77enum Foo {
78 Bar
79}
80struct Baz;
81fn foo() {
82 let local = ();
83 let _: $0;
84}
85"#,
86 expect![[r#"
87 en Foo
88 st Baz
89 "#]],
90 );
91 }
92
93 #[test]
72 fn only_completes_modules_in_import() { 94 fn only_completes_modules_in_import() {
73 cov_mark::check!(only_completes_modules_in_import); 95 cov_mark::check!(only_completes_modules_in_import);
74 check( 96 check(