diff options
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/keyword.rs | 28 | ||||
-rw-r--r-- | crates/ide_completion/src/completions/pattern.rs | 395 | ||||
-rw-r--r-- | crates/ide_completion/src/completions/qualified_path.rs | 76 | ||||
-rw-r--r-- | crates/ide_completion/src/completions/unqualified_path.rs | 147 |
4 files changed, 5 insertions, 641 deletions
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs index 07541c79c..407f796ef 100644 --- a/crates/ide_completion/src/completions/keyword.rs +++ b/crates/ide_completion/src/completions/keyword.rs | |||
@@ -92,7 +92,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte | |||
92 | } | 92 | } |
93 | 93 | ||
94 | if !ctx.has_visibility_prev_sibling() | 94 | if !ctx.has_visibility_prev_sibling() |
95 | && (expects_item || ctx.expects_non_trait_assoc_item() || ctx.expect_record_field()) | 95 | && (expects_item || ctx.expects_non_trait_assoc_item() || ctx.expect_field()) |
96 | { | 96 | { |
97 | add_keyword("pub(crate)", "pub(crate) "); | 97 | add_keyword("pub(crate)", "pub(crate) "); |
98 | add_keyword("pub", "pub "); | 98 | add_keyword("pub", "pub "); |
@@ -122,6 +122,10 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte | |||
122 | add_keyword("union", "union $1 {\n $0\n}"); | 122 | add_keyword("union", "union $1 {\n $0\n}"); |
123 | } | 123 | } |
124 | 124 | ||
125 | if ctx.expects_type() { | ||
126 | return; | ||
127 | } | ||
128 | |||
125 | if ctx.expects_expression() { | 129 | if ctx.expects_expression() { |
126 | if !has_block_expr_parent { | 130 | if !has_block_expr_parent { |
127 | add_keyword("unsafe", "unsafe {\n $0\n}"); | 131 | add_keyword("unsafe", "unsafe {\n $0\n}"); |
@@ -373,28 +377,6 @@ fn quux() -> i32 { | |||
373 | } | 377 | } |
374 | 378 | ||
375 | #[test] | 379 | #[test] |
376 | fn test_mut_in_ref_and_in_fn_parameters_list() { | ||
377 | check( | ||
378 | r"fn my_fn(&$0) {}", | ||
379 | expect![[r#" | ||
380 | kw mut | ||
381 | "#]], | ||
382 | ); | ||
383 | check( | ||
384 | r"fn my_fn($0) {}", | ||
385 | expect![[r#" | ||
386 | kw mut | ||
387 | "#]], | ||
388 | ); | ||
389 | check( | ||
390 | r"fn my_fn() { let &$0 }", | ||
391 | expect![[r#" | ||
392 | kw mut | ||
393 | "#]], | ||
394 | ); | ||
395 | } | ||
396 | |||
397 | #[test] | ||
398 | fn no_keyword_completion_in_comments() { | 380 | fn no_keyword_completion_in_comments() { |
399 | cov_mark::check!(no_keyword_completion_in_comments); | 381 | cov_mark::check!(no_keyword_completion_in_comments); |
400 | check( | 382 | check( |
diff --git a/crates/ide_completion/src/completions/pattern.rs b/crates/ide_completion/src/completions/pattern.rs index efe3c957a..bd13a62d7 100644 --- a/crates/ide_completion/src/completions/pattern.rs +++ b/crates/ide_completion/src/completions/pattern.rs | |||
@@ -55,398 +55,3 @@ pub(crate) fn complete_pattern(acc: &mut Completions, ctx: &CompletionContext) { | |||
55 | } | 55 | } |
56 | }); | 56 | }); |
57 | } | 57 | } |
58 | |||
59 | #[cfg(test)] | ||
60 | mod tests { | ||
61 | use expect_test::{expect, Expect}; | ||
62 | |||
63 | use crate::{ | ||
64 | tests::{check_edit, filtered_completion_list}, | ||
65 | CompletionKind, | ||
66 | }; | ||
67 | |||
68 | fn check(ra_fixture: &str, expect: Expect) { | ||
69 | let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference); | ||
70 | expect.assert_eq(&actual) | ||
71 | } | ||
72 | |||
73 | fn check_snippet(ra_fixture: &str, expect: Expect) { | ||
74 | let actual = filtered_completion_list(ra_fixture, CompletionKind::Snippet); | ||
75 | expect.assert_eq(&actual) | ||
76 | } | ||
77 | |||
78 | #[test] | ||
79 | fn completes_enum_variants_and_modules() { | ||
80 | check( | ||
81 | r#" | ||
82 | enum E { X } | ||
83 | use self::E::X; | ||
84 | const Z: E = E::X; | ||
85 | mod m {} | ||
86 | |||
87 | static FOO: E = E::X; | ||
88 | struct Bar { f: u32 } | ||
89 | |||
90 | fn foo() { | ||
91 | match E::X { a$0 } | ||
92 | } | ||
93 | "#, | ||
94 | expect![[r#" | ||
95 | en E | ||
96 | ct Z | ||
97 | st Bar | ||
98 | ev X | ||
99 | md m | ||
100 | "#]], | ||
101 | ); | ||
102 | } | ||
103 | |||
104 | #[test] | ||
105 | fn does_not_complete_non_fn_macros() { | ||
106 | check( | ||
107 | r#" | ||
108 | macro_rules! m { ($e:expr) => { $e } } | ||
109 | enum E { X } | ||
110 | |||
111 | #[rustc_builtin_macro] | ||
112 | macro Clone {} | ||
113 | |||
114 | fn foo() { | ||
115 | match E::X { $0 } | ||
116 | } | ||
117 | "#, | ||
118 | expect![[r#" | ||
119 | ev E::X () | ||
120 | en E | ||
121 | ma m!(…) macro_rules! m | ||
122 | "#]], | ||
123 | ); | ||
124 | } | ||
125 | |||
126 | #[test] | ||
127 | fn completes_in_simple_macro_call() { | ||
128 | check( | ||
129 | r#" | ||
130 | macro_rules! m { ($e:expr) => { $e } } | ||
131 | enum E { X } | ||
132 | |||
133 | fn foo() { | ||
134 | m!(match E::X { a$0 }) | ||
135 | } | ||
136 | "#, | ||
137 | expect![[r#" | ||
138 | ev E::X () | ||
139 | en E | ||
140 | ma m!(…) macro_rules! m | ||
141 | "#]], | ||
142 | ); | ||
143 | } | ||
144 | |||
145 | #[test] | ||
146 | fn completes_in_irrefutable_let() { | ||
147 | check( | ||
148 | r#" | ||
149 | enum E { X } | ||
150 | use self::E::X; | ||
151 | const Z: E = E::X; | ||
152 | mod m {} | ||
153 | |||
154 | static FOO: E = E::X; | ||
155 | struct Bar { f: u32 } | ||
156 | |||
157 | fn foo() { | ||
158 | let a$0 | ||
159 | } | ||
160 | "#, | ||
161 | expect![[r#" | ||
162 | st Bar | ||
163 | "#]], | ||
164 | ); | ||
165 | } | ||
166 | |||
167 | #[test] | ||
168 | fn completes_in_param() { | ||
169 | check( | ||
170 | r#" | ||
171 | enum E { X } | ||
172 | |||
173 | static FOO: E = E::X; | ||
174 | struct Bar { f: u32 } | ||
175 | |||
176 | fn foo(a$0) { | ||
177 | } | ||
178 | "#, | ||
179 | expect![[r#" | ||
180 | st Bar | ||
181 | "#]], | ||
182 | ); | ||
183 | } | ||
184 | |||
185 | #[test] | ||
186 | fn completes_pat_in_let() { | ||
187 | check_snippet( | ||
188 | r#" | ||
189 | struct Bar { f: u32 } | ||
190 | |||
191 | fn foo() { | ||
192 | let a$0 | ||
193 | } | ||
194 | "#, | ||
195 | expect![[r#" | ||
196 | bn Bar Bar { f$1 }$0 | ||
197 | "#]], | ||
198 | ); | ||
199 | } | ||
200 | |||
201 | #[test] | ||
202 | fn completes_param_pattern() { | ||
203 | check_snippet( | ||
204 | r#" | ||
205 | struct Foo { bar: String, baz: String } | ||
206 | struct Bar(String, String); | ||
207 | struct Baz; | ||
208 | fn outer(a$0) {} | ||
209 | "#, | ||
210 | expect![[r#" | ||
211 | bn Foo Foo { bar$1, baz$2 }: Foo$0 | ||
212 | bn Bar Bar($1, $2): Bar$0 | ||
213 | "#]], | ||
214 | ) | ||
215 | } | ||
216 | |||
217 | #[test] | ||
218 | fn completes_let_pattern() { | ||
219 | check_snippet( | ||
220 | r#" | ||
221 | struct Foo { bar: String, baz: String } | ||
222 | struct Bar(String, String); | ||
223 | struct Baz; | ||
224 | fn outer() { | ||
225 | let a$0 | ||
226 | } | ||
227 | "#, | ||
228 | expect![[r#" | ||
229 | bn Foo Foo { bar$1, baz$2 }$0 | ||
230 | bn Bar Bar($1, $2)$0 | ||
231 | "#]], | ||
232 | ) | ||
233 | } | ||
234 | |||
235 | #[test] | ||
236 | fn completes_refutable_pattern() { | ||
237 | check_snippet( | ||
238 | r#" | ||
239 | struct Foo { bar: i32, baz: i32 } | ||
240 | struct Bar(String, String); | ||
241 | struct Baz; | ||
242 | fn outer() { | ||
243 | match () { | ||
244 | a$0 | ||
245 | } | ||
246 | } | ||
247 | "#, | ||
248 | expect![[r#" | ||
249 | bn Foo Foo { bar$1, baz$2 }$0 | ||
250 | bn Bar Bar($1, $2)$0 | ||
251 | "#]], | ||
252 | ) | ||
253 | } | ||
254 | |||
255 | #[test] | ||
256 | fn omits_private_fields_pat() { | ||
257 | check_snippet( | ||
258 | r#" | ||
259 | mod foo { | ||
260 | pub struct Foo { pub bar: i32, baz: i32 } | ||
261 | pub struct Bar(pub String, String); | ||
262 | pub struct Invisible(String, String); | ||
263 | } | ||
264 | use foo::*; | ||
265 | |||
266 | fn outer() { | ||
267 | match () { | ||
268 | a$0 | ||
269 | } | ||
270 | } | ||
271 | "#, | ||
272 | expect![[r#" | ||
273 | bn Foo Foo { bar$1, .. }$0 | ||
274 | bn Bar Bar($1, ..)$0 | ||
275 | "#]], | ||
276 | ) | ||
277 | } | ||
278 | |||
279 | #[test] | ||
280 | fn only_shows_ident_completion() { | ||
281 | check_edit( | ||
282 | "Foo", | ||
283 | r#" | ||
284 | struct Foo(i32); | ||
285 | fn main() { | ||
286 | match Foo(92) { | ||
287 | a$0(92) => (), | ||
288 | } | ||
289 | } | ||
290 | "#, | ||
291 | r#" | ||
292 | struct Foo(i32); | ||
293 | fn main() { | ||
294 | match Foo(92) { | ||
295 | Foo(92) => (), | ||
296 | } | ||
297 | } | ||
298 | "#, | ||
299 | ); | ||
300 | } | ||
301 | |||
302 | #[test] | ||
303 | fn completes_self_pats() { | ||
304 | check_snippet( | ||
305 | r#" | ||
306 | struct Foo(i32); | ||
307 | impl Foo { | ||
308 | fn foo() { | ||
309 | match () { | ||
310 | a$0 | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | "#, | ||
315 | expect![[r#" | ||
316 | bn Self Self($1)$0 | ||
317 | bn Foo Foo($1)$0 | ||
318 | "#]], | ||
319 | ) | ||
320 | } | ||
321 | |||
322 | #[test] | ||
323 | fn completes_qualified_variant() { | ||
324 | check_snippet( | ||
325 | r#" | ||
326 | enum Foo { | ||
327 | Bar { baz: i32 } | ||
328 | } | ||
329 | impl Foo { | ||
330 | fn foo() { | ||
331 | match {Foo::Bar { baz: 0 }} { | ||
332 | B$0 | ||
333 | } | ||
334 | } | ||
335 | } | ||
336 | "#, | ||
337 | expect![[r#" | ||
338 | bn Self::Bar Self::Bar { baz$1 }$0 | ||
339 | bn Foo::Bar Foo::Bar { baz$1 }$0 | ||
340 | "#]], | ||
341 | ) | ||
342 | } | ||
343 | |||
344 | #[test] | ||
345 | fn completes_enum_variant_matcharm() { | ||
346 | check( | ||
347 | r#" | ||
348 | enum Foo { Bar, Baz, Quux } | ||
349 | |||
350 | fn main() { | ||
351 | let foo = Foo::Quux; | ||
352 | match foo { Qu$0 } | ||
353 | } | ||
354 | "#, | ||
355 | expect![[r#" | ||
356 | ev Foo::Bar () | ||
357 | ev Foo::Baz () | ||
358 | ev Foo::Quux () | ||
359 | en Foo | ||
360 | "#]], | ||
361 | ) | ||
362 | } | ||
363 | |||
364 | #[test] | ||
365 | fn completes_enum_variant_matcharm_ref() { | ||
366 | check( | ||
367 | r#" | ||
368 | enum Foo { Bar, Baz, Quux } | ||
369 | |||
370 | fn main() { | ||
371 | let foo = Foo::Quux; | ||
372 | match &foo { Qu$0 } | ||
373 | } | ||
374 | "#, | ||
375 | expect![[r#" | ||
376 | ev Foo::Bar () | ||
377 | ev Foo::Baz () | ||
378 | ev Foo::Quux () | ||
379 | en Foo | ||
380 | "#]], | ||
381 | ) | ||
382 | } | ||
383 | |||
384 | #[test] | ||
385 | fn completes_enum_variant_iflet() { | ||
386 | check( | ||
387 | r#" | ||
388 | enum Foo { Bar, Baz, Quux } | ||
389 | |||
390 | fn main() { | ||
391 | let foo = Foo::Quux; | ||
392 | if let Qu$0 = foo { } | ||
393 | } | ||
394 | "#, | ||
395 | expect![[r#" | ||
396 | ev Foo::Bar () | ||
397 | ev Foo::Baz () | ||
398 | ev Foo::Quux () | ||
399 | en Foo | ||
400 | "#]], | ||
401 | ) | ||
402 | } | ||
403 | |||
404 | #[test] | ||
405 | fn completes_enum_variant_impl() { | ||
406 | check( | ||
407 | r#" | ||
408 | enum Foo { Bar, Baz, Quux } | ||
409 | impl Foo { | ||
410 | fn foo() { match Foo::Bar { Q$0 } } | ||
411 | } | ||
412 | "#, | ||
413 | expect![[r#" | ||
414 | ev Self::Bar () | ||
415 | ev Self::Baz () | ||
416 | ev Self::Quux () | ||
417 | ev Foo::Bar () | ||
418 | ev Foo::Baz () | ||
419 | ev Foo::Quux () | ||
420 | sp Self | ||
421 | en Foo | ||
422 | "#]], | ||
423 | ) | ||
424 | } | ||
425 | |||
426 | #[test] | ||
427 | fn completes_in_record_field_pat() { | ||
428 | check_snippet( | ||
429 | r#" | ||
430 | struct Foo { bar: Bar } | ||
431 | struct Bar(u32); | ||
432 | fn outer(Foo { bar: $0 }: Foo) {} | ||
433 | "#, | ||
434 | expect![[r#" | ||
435 | bn Foo Foo { bar$1 }$0 | ||
436 | bn Bar Bar($1)$0 | ||
437 | "#]], | ||
438 | ) | ||
439 | } | ||
440 | |||
441 | #[test] | ||
442 | fn skips_in_record_field_pat_name() { | ||
443 | check_snippet( | ||
444 | r#" | ||
445 | struct Foo { bar: Bar } | ||
446 | struct Bar(u32); | ||
447 | fn outer(Foo { bar$0 }: Foo) {} | ||
448 | "#, | ||
449 | expect![[r#""#]], | ||
450 | ) | ||
451 | } | ||
452 | } | ||
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs index f5dbd203b..1b8997ecf 100644 --- a/crates/ide_completion/src/completions/qualified_path.rs +++ b/crates/ide_completion/src/completions/qualified_path.rs | |||
@@ -219,36 +219,6 @@ mod tests { | |||
219 | } | 219 | } |
220 | 220 | ||
221 | #[test] | 221 | #[test] |
222 | fn dont_complete_values_in_type_pos() { | ||
223 | check( | ||
224 | r#" | ||
225 | const FOO: () = (); | ||
226 | static BAR: () = (); | ||
227 | struct Baz; | ||
228 | fn foo() { | ||
229 | let _: self::$0; | ||
230 | } | ||
231 | "#, | ||
232 | expect![[r#" | ||
233 | st Baz | ||
234 | "#]], | ||
235 | ); | ||
236 | } | ||
237 | |||
238 | #[test] | ||
239 | fn dont_complete_enum_variants_in_type_pos() { | ||
240 | check( | ||
241 | r#" | ||
242 | enum Foo { Bar } | ||
243 | fn foo() { | ||
244 | let _: Foo::$0; | ||
245 | } | ||
246 | "#, | ||
247 | expect![[r#""#]], | ||
248 | ); | ||
249 | } | ||
250 | |||
251 | #[test] | ||
252 | fn dont_complete_primitive_in_use() { | 222 | fn dont_complete_primitive_in_use() { |
253 | check_builtin(r#"use self::$0;"#, expect![[""]]); | 223 | check_builtin(r#"use self::$0;"#, expect![[""]]); |
254 | } | 224 | } |
@@ -259,32 +229,6 @@ fn foo() { | |||
259 | } | 229 | } |
260 | 230 | ||
261 | #[test] | 231 | #[test] |
262 | fn completes_primitives() { | ||
263 | check_builtin( | ||
264 | r#"fn main() { let _: $0 = 92; }"#, | ||
265 | expect![[r#" | ||
266 | bt u32 | ||
267 | bt bool | ||
268 | bt u8 | ||
269 | bt isize | ||
270 | bt u16 | ||
271 | bt u64 | ||
272 | bt u128 | ||
273 | bt f32 | ||
274 | bt i128 | ||
275 | bt i16 | ||
276 | bt str | ||
277 | bt i64 | ||
278 | bt char | ||
279 | bt f64 | ||
280 | bt i32 | ||
281 | bt i8 | ||
282 | bt usize | ||
283 | "#]], | ||
284 | ); | ||
285 | } | ||
286 | |||
287 | #[test] | ||
288 | fn completes_enum_variant() { | 232 | fn completes_enum_variant() { |
289 | check( | 233 | check( |
290 | r#" | 234 | r#" |
@@ -749,24 +693,4 @@ fn main() { | |||
749 | "#]], | 693 | "#]], |
750 | ); | 694 | ); |
751 | } | 695 | } |
752 | |||
753 | #[test] | ||
754 | fn completes_types_and_const_in_arg_list() { | ||
755 | check( | ||
756 | r#" | ||
757 | mod foo { | ||
758 | pub const CONST: () = (); | ||
759 | pub type Type = (); | ||
760 | } | ||
761 | |||
762 | struct Foo<T>(t); | ||
763 | |||
764 | fn foo(_: Foo<foo::$0>) {} | ||
765 | "#, | ||
766 | expect![[r#" | ||
767 | ta Type | ||
768 | ct CONST | ||
769 | "#]], | ||
770 | ); | ||
771 | } | ||
772 | } | 696 | } |
diff --git a/crates/ide_completion/src/completions/unqualified_path.rs b/crates/ide_completion/src/completions/unqualified_path.rs index 81c4fb305..380c1e079 100644 --- a/crates/ide_completion/src/completions/unqualified_path.rs +++ b/crates/ide_completion/src/completions/unqualified_path.rs | |||
@@ -113,78 +113,6 @@ mod tests { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | #[test] | 115 | #[test] |
116 | fn dont_complete_values_in_type_pos() { | ||
117 | check( | ||
118 | r#" | ||
119 | const FOO: () = (); | ||
120 | static BAR: () = (); | ||
121 | enum Foo { | ||
122 | Bar | ||
123 | } | ||
124 | struct Baz; | ||
125 | fn foo() { | ||
126 | let local = (); | ||
127 | let _: $0; | ||
128 | } | ||
129 | "#, | ||
130 | expect![[r#" | ||
131 | en Foo | ||
132 | st Baz | ||
133 | "#]], | ||
134 | ); | ||
135 | } | ||
136 | |||
137 | #[test] | ||
138 | fn bind_pat_and_path_ignore_at() { | ||
139 | check( | ||
140 | r#" | ||
141 | enum Enum { A, B } | ||
142 | fn quux(x: Option<Enum>) { | ||
143 | match x { | ||
144 | None => (), | ||
145 | Some(en$0 @ Enum::A) => (), | ||
146 | } | ||
147 | } | ||
148 | "#, | ||
149 | expect![[r#""#]], | ||
150 | ); | ||
151 | } | ||
152 | |||
153 | #[test] | ||
154 | fn bind_pat_and_path_ignore_ref() { | ||
155 | check( | ||
156 | r#" | ||
157 | enum Enum { A, B } | ||
158 | fn quux(x: Option<Enum>) { | ||
159 | match x { | ||
160 | None => (), | ||
161 | Some(ref en$0) => (), | ||
162 | } | ||
163 | } | ||
164 | "#, | ||
165 | expect![[r#""#]], | ||
166 | ); | ||
167 | } | ||
168 | |||
169 | #[test] | ||
170 | fn bind_pat_and_path() { | ||
171 | check( | ||
172 | r#" | ||
173 | enum Enum { A, B } | ||
174 | fn quux(x: Option<Enum>) { | ||
175 | match x { | ||
176 | None => (), | ||
177 | Some(En$0) => (), | ||
178 | } | ||
179 | } | ||
180 | "#, | ||
181 | expect![[r#" | ||
182 | en Enum | ||
183 | "#]], | ||
184 | ); | ||
185 | } | ||
186 | |||
187 | #[test] | ||
188 | fn completes_bindings_from_let() { | 116 | fn completes_bindings_from_let() { |
189 | check( | 117 | check( |
190 | r#" | 118 | r#" |
@@ -289,29 +217,6 @@ fn main() { | |||
289 | } | 217 | } |
290 | 218 | ||
291 | #[test] | 219 | #[test] |
292 | fn completes_generic_params_in_struct() { | ||
293 | check( | ||
294 | r#"struct S<T> { x: $0}"#, | ||
295 | expect![[r#" | ||
296 | sp Self | ||
297 | tp T | ||
298 | st S<…> | ||
299 | "#]], | ||
300 | ); | ||
301 | } | ||
302 | |||
303 | #[test] | ||
304 | fn completes_self_in_enum() { | ||
305 | check( | ||
306 | r#"enum X { Y($0) }"#, | ||
307 | expect![[r#" | ||
308 | sp Self | ||
309 | en X | ||
310 | "#]], | ||
311 | ); | ||
312 | } | ||
313 | |||
314 | #[test] | ||
315 | fn completes_module_items() { | 220 | fn completes_module_items() { |
316 | check( | 221 | check( |
317 | r#" | 222 | r#" |
@@ -365,19 +270,6 @@ mod m { | |||
365 | } | 270 | } |
366 | 271 | ||
367 | #[test] | 272 | #[test] |
368 | fn completes_return_type() { | ||
369 | check( | ||
370 | r#" | ||
371 | struct Foo; | ||
372 | fn x() -> $0 | ||
373 | "#, | ||
374 | expect![[r#" | ||
375 | st Foo | ||
376 | "#]], | ||
377 | ); | ||
378 | } | ||
379 | |||
380 | #[test] | ||
381 | fn dont_show_both_completions_for_shadowing() { | 273 | fn dont_show_both_completions_for_shadowing() { |
382 | check( | 274 | check( |
383 | r#" | 275 | r#" |
@@ -559,19 +451,6 @@ fn foo() { $0 } | |||
559 | } | 451 | } |
560 | 452 | ||
561 | #[test] | 453 | #[test] |
562 | fn completes_macros_as_type() { | ||
563 | check( | ||
564 | r#" | ||
565 | macro_rules! foo { () => {} } | ||
566 | fn main() { let x: $0 } | ||
567 | "#, | ||
568 | expect![[r#" | ||
569 | ma foo!(…) macro_rules! foo | ||
570 | "#]], | ||
571 | ); | ||
572 | } | ||
573 | |||
574 | #[test] | ||
575 | fn completes_macros_as_stmt() { | 454 | fn completes_macros_as_stmt() { |
576 | check( | 455 | check( |
577 | r#" | 456 | r#" |
@@ -716,30 +595,4 @@ fn f() {} | |||
716 | expect![[""]], | 595 | expect![[""]], |
717 | ) | 596 | ) |
718 | } | 597 | } |
719 | |||
720 | #[test] | ||
721 | fn completes_types_and_const_in_arg_list() { | ||
722 | check( | ||
723 | r#" | ||
724 | enum Bar { | ||
725 | Baz | ||
726 | } | ||
727 | trait Foo { | ||
728 | type Bar; | ||
729 | } | ||
730 | |||
731 | const CONST: () = (); | ||
732 | |||
733 | fn foo<T: Foo<$0>, const CONST_PARAM: usize>(_: T) {} | ||
734 | "#, | ||
735 | expect![[r#" | ||
736 | ta Bar = type Bar; | ||
737 | tp T | ||
738 | cp CONST_PARAM | ||
739 | tt Foo | ||
740 | en Bar | ||
741 | ct CONST | ||
742 | "#]], | ||
743 | ); | ||
744 | } | ||
745 | } | 598 | } |