diff options
Diffstat (limited to 'crates/ra_ide/src/completion/complete_attribute.rs')
-rw-r--r-- | crates/ra_ide/src/completion/complete_attribute.rs | 590 |
1 files changed, 362 insertions, 228 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index fb3f0b743..6beeca457 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs | |||
@@ -20,6 +20,7 @@ pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) | |||
20 | { | 20 | { |
21 | complete_derive(acc, ctx, token_tree) | 21 | complete_derive(acc, ctx, token_tree) |
22 | } | 22 | } |
23 | (_, Some(ast::AttrInput::TokenTree(_token_tree))) => {} | ||
23 | _ => complete_attribute_start(acc, ctx, attribute), | 24 | _ => complete_attribute_start(acc, ctx, attribute), |
24 | } | 25 | } |
25 | Some(()) | 26 | Some(()) |
@@ -34,6 +35,10 @@ fn complete_attribute_start(acc: &mut Completions, ctx: &CompletionContext, attr | |||
34 | ) | 35 | ) |
35 | .kind(CompletionItemKind::Attribute); | 36 | .kind(CompletionItemKind::Attribute); |
36 | 37 | ||
38 | if let Some(lookup) = attr_completion.lookup { | ||
39 | item = item.lookup_by(lookup); | ||
40 | } | ||
41 | |||
37 | match (attr_completion.snippet, ctx.config.snippet_cap) { | 42 | match (attr_completion.snippet, ctx.config.snippet_cap) { |
38 | (Some(snippet), Some(cap)) => { | 43 | (Some(snippet), Some(cap)) => { |
39 | item = item.insert_snippet(cap, snippet); | 44 | item = item.insert_snippet(cap, snippet); |
@@ -49,84 +54,160 @@ fn complete_attribute_start(acc: &mut Completions, ctx: &CompletionContext, attr | |||
49 | 54 | ||
50 | struct AttrCompletion { | 55 | struct AttrCompletion { |
51 | label: &'static str, | 56 | label: &'static str, |
57 | lookup: Option<&'static str>, | ||
52 | snippet: Option<&'static str>, | 58 | snippet: Option<&'static str>, |
53 | should_be_inner: bool, | 59 | should_be_inner: bool, |
54 | } | 60 | } |
55 | 61 | ||
56 | const ATTRIBUTES: &[AttrCompletion] = &[ | 62 | const ATTRIBUTES: &[AttrCompletion] = &[ |
57 | AttrCompletion { label: "allow", snippet: Some("allow(${0:lint})"), should_be_inner: false }, | ||
58 | AttrCompletion { | 63 | AttrCompletion { |
59 | label: "cfg_attr", | 64 | label: "allow(…)", |
65 | snippet: Some("allow(${0:lint})"), | ||
66 | should_be_inner: false, | ||
67 | lookup: Some("allow"), | ||
68 | }, | ||
69 | AttrCompletion { | ||
70 | label: "cfg_attr(…)", | ||
60 | snippet: Some("cfg_attr(${1:predicate}, ${0:attr})"), | 71 | snippet: Some("cfg_attr(${1:predicate}, ${0:attr})"), |
61 | should_be_inner: false, | 72 | should_be_inner: false, |
73 | lookup: Some("cfg_attr"), | ||
74 | }, | ||
75 | AttrCompletion { | ||
76 | label: "cfg(…)", | ||
77 | snippet: Some("cfg(${0:predicate})"), | ||
78 | should_be_inner: false, | ||
79 | lookup: Some("cfg"), | ||
80 | }, | ||
81 | AttrCompletion { | ||
82 | label: "deny(…)", | ||
83 | snippet: Some("deny(${0:lint})"), | ||
84 | should_be_inner: false, | ||
85 | lookup: Some("deny"), | ||
62 | }, | 86 | }, |
63 | AttrCompletion { label: "cfg", snippet: Some("cfg(${0:predicate})"), should_be_inner: false }, | ||
64 | AttrCompletion { label: "deny", snippet: Some("deny(${0:lint})"), should_be_inner: false }, | ||
65 | AttrCompletion { | 87 | AttrCompletion { |
66 | label: "deprecated", | 88 | label: r#"deprecated = "…""#, |
67 | snippet: Some(r#"deprecated = "${0:reason}""#), | 89 | snippet: Some(r#"deprecated = "${0:reason}""#), |
68 | should_be_inner: false, | 90 | should_be_inner: false, |
91 | lookup: Some("deprecated"), | ||
69 | }, | 92 | }, |
70 | AttrCompletion { | 93 | AttrCompletion { |
71 | label: "derive", | 94 | label: "derive(…)", |
72 | snippet: Some(r#"derive(${0:Debug})"#), | 95 | snippet: Some(r#"derive(${0:Debug})"#), |
73 | should_be_inner: false, | 96 | should_be_inner: false, |
97 | lookup: Some("derive"), | ||
98 | }, | ||
99 | AttrCompletion { | ||
100 | label: r#"doc = "…""#, | ||
101 | snippet: Some(r#"doc = "${0:docs}""#), | ||
102 | should_be_inner: false, | ||
103 | lookup: Some("doc"), | ||
104 | }, | ||
105 | AttrCompletion { | ||
106 | label: "feature(…)", | ||
107 | snippet: Some("feature(${0:flag})"), | ||
108 | should_be_inner: true, | ||
109 | lookup: Some("feature"), | ||
110 | }, | ||
111 | AttrCompletion { | ||
112 | label: "forbid(…)", | ||
113 | snippet: Some("forbid(${0:lint})"), | ||
114 | should_be_inner: false, | ||
115 | lookup: Some("forbid"), | ||
74 | }, | 116 | }, |
75 | AttrCompletion { label: "doc", snippet: Some(r#"doc = "${0:docs}""#), should_be_inner: false }, | ||
76 | AttrCompletion { label: "feature", snippet: Some("feature(${0:flag})"), should_be_inner: true }, | ||
77 | AttrCompletion { label: "forbid", snippet: Some("forbid(${0:lint})"), should_be_inner: false }, | ||
78 | // FIXME: resolve through macro resolution? | 117 | // FIXME: resolve through macro resolution? |
79 | AttrCompletion { label: "global_allocator", snippet: None, should_be_inner: true }, | ||
80 | AttrCompletion { label: "ignore", snippet: Some("ignore(${0:lint})"), should_be_inner: false }, | ||
81 | AttrCompletion { label: "inline", snippet: Some("inline(${0:lint})"), should_be_inner: false }, | ||
82 | AttrCompletion { | 118 | AttrCompletion { |
83 | label: "link_name", | 119 | label: "global_allocator", |
120 | snippet: None, | ||
121 | should_be_inner: true, | ||
122 | lookup: None, | ||
123 | }, | ||
124 | AttrCompletion { | ||
125 | label: "ignore(…)", | ||
126 | snippet: Some("ignore(${0:lint})"), | ||
127 | should_be_inner: false, | ||
128 | lookup: Some("ignore"), | ||
129 | }, | ||
130 | AttrCompletion { | ||
131 | label: "inline(…)", | ||
132 | snippet: Some("inline(${0:lint})"), | ||
133 | should_be_inner: false, | ||
134 | lookup: Some("inline"), | ||
135 | }, | ||
136 | AttrCompletion { | ||
137 | label: r#"link_name = "…""#, | ||
84 | snippet: Some(r#"link_name = "${0:symbol_name}""#), | 138 | snippet: Some(r#"link_name = "${0:symbol_name}""#), |
85 | should_be_inner: false, | 139 | should_be_inner: false, |
140 | lookup: Some("link_name"), | ||
86 | }, | 141 | }, |
87 | AttrCompletion { label: "link", snippet: None, should_be_inner: false }, | 142 | AttrCompletion { label: "link", snippet: None, should_be_inner: false, lookup: None }, |
88 | AttrCompletion { label: "macro_export", snippet: None, should_be_inner: false }, | 143 | AttrCompletion { label: "macro_export", snippet: None, should_be_inner: false, lookup: None }, |
89 | AttrCompletion { label: "macro_use", snippet: None, should_be_inner: false }, | 144 | AttrCompletion { label: "macro_use", snippet: None, should_be_inner: false, lookup: None }, |
90 | AttrCompletion { | 145 | AttrCompletion { |
91 | label: "must_use", | 146 | label: r#"must_use = "…""#, |
92 | snippet: Some(r#"must_use = "${0:reason}""#), | 147 | snippet: Some(r#"must_use = "${0:reason}""#), |
93 | should_be_inner: false, | 148 | should_be_inner: false, |
149 | lookup: Some("must_use"), | ||
150 | }, | ||
151 | AttrCompletion { label: "no_mangle", snippet: None, should_be_inner: false, lookup: None }, | ||
152 | AttrCompletion { label: "no_std", snippet: None, should_be_inner: true, lookup: None }, | ||
153 | AttrCompletion { label: "non_exhaustive", snippet: None, should_be_inner: false, lookup: None }, | ||
154 | AttrCompletion { label: "panic_handler", snippet: None, should_be_inner: true, lookup: None }, | ||
155 | AttrCompletion { | ||
156 | label: "path = \"…\"", | ||
157 | snippet: Some("path =\"${0:path}\""), | ||
158 | should_be_inner: false, | ||
159 | lookup: Some("path"), | ||
160 | }, | ||
161 | AttrCompletion { label: "proc_macro", snippet: None, should_be_inner: false, lookup: None }, | ||
162 | AttrCompletion { | ||
163 | label: "proc_macro_attribute", | ||
164 | snippet: None, | ||
165 | should_be_inner: false, | ||
166 | lookup: None, | ||
94 | }, | 167 | }, |
95 | AttrCompletion { label: "no_mangle", snippet: None, should_be_inner: false }, | ||
96 | AttrCompletion { label: "no_std", snippet: None, should_be_inner: true }, | ||
97 | AttrCompletion { label: "non_exhaustive", snippet: None, should_be_inner: false }, | ||
98 | AttrCompletion { label: "panic_handler", snippet: None, should_be_inner: true }, | ||
99 | AttrCompletion { label: "path", snippet: Some("path =\"${0:path}\""), should_be_inner: false }, | ||
100 | AttrCompletion { label: "proc_macro", snippet: None, should_be_inner: false }, | ||
101 | AttrCompletion { label: "proc_macro_attribute", snippet: None, should_be_inner: false }, | ||
102 | AttrCompletion { | 168 | AttrCompletion { |
103 | label: "proc_macro_derive", | 169 | label: "proc_macro_derive(…)", |
104 | snippet: Some("proc_macro_derive(${0:Trait})"), | 170 | snippet: Some("proc_macro_derive(${0:Trait})"), |
105 | should_be_inner: false, | 171 | should_be_inner: false, |
172 | lookup: Some("proc_macro_derive"), | ||
106 | }, | 173 | }, |
107 | AttrCompletion { | 174 | AttrCompletion { |
108 | label: "recursion_limit", | 175 | label: "recursion_limit = …", |
109 | snippet: Some("recursion_limit = ${0:128}"), | 176 | snippet: Some("recursion_limit = ${0:128}"), |
110 | should_be_inner: true, | 177 | should_be_inner: true, |
178 | lookup: Some("recursion_limit"), | ||
179 | }, | ||
180 | AttrCompletion { | ||
181 | label: "repr(…)", | ||
182 | snippet: Some("repr(${0:C})"), | ||
183 | should_be_inner: false, | ||
184 | lookup: Some("repr"), | ||
111 | }, | 185 | }, |
112 | AttrCompletion { label: "repr", snippet: Some("repr(${0:C})"), should_be_inner: false }, | ||
113 | AttrCompletion { | 186 | AttrCompletion { |
114 | label: "should_panic", | 187 | label: "should_panic(…)", |
115 | snippet: Some(r#"should_panic(expected = "${0:reason}")"#), | 188 | snippet: Some(r#"should_panic(expected = "${0:reason}")"#), |
116 | should_be_inner: false, | 189 | should_be_inner: false, |
190 | lookup: Some("should_panic"), | ||
117 | }, | 191 | }, |
118 | AttrCompletion { | 192 | AttrCompletion { |
119 | label: "target_feature", | 193 | label: r#"target_feature = "…""#, |
120 | snippet: Some("target_feature = \"${0:feature}\""), | 194 | snippet: Some("target_feature = \"${0:feature}\""), |
121 | should_be_inner: false, | 195 | should_be_inner: false, |
196 | lookup: Some("target_feature"), | ||
197 | }, | ||
198 | AttrCompletion { label: "test", snippet: None, should_be_inner: false, lookup: None }, | ||
199 | AttrCompletion { label: "used", snippet: None, should_be_inner: false, lookup: None }, | ||
200 | AttrCompletion { | ||
201 | label: "warn(…)", | ||
202 | snippet: Some("warn(${0:lint})"), | ||
203 | should_be_inner: false, | ||
204 | lookup: Some("warn"), | ||
122 | }, | 205 | }, |
123 | AttrCompletion { label: "test", snippet: None, should_be_inner: false }, | ||
124 | AttrCompletion { label: "used", snippet: None, should_be_inner: false }, | ||
125 | AttrCompletion { label: "warn", snippet: Some("warn(${0:lint})"), should_be_inner: false }, | ||
126 | AttrCompletion { | 206 | AttrCompletion { |
127 | label: "windows_subsystem", | 207 | label: r#"windows_subsystem = "…""#, |
128 | snippet: Some(r#"windows_subsystem = "${0:subsystem}""#), | 208 | snippet: Some(r#"windows_subsystem = "${0:subsystem}""#), |
129 | should_be_inner: true, | 209 | should_be_inner: true, |
210 | lookup: Some("windows_subsystem"), | ||
130 | }, | 211 | }, |
131 | ]; | 212 | ]; |
132 | 213 | ||
@@ -252,69 +333,69 @@ mod tests { | |||
252 | [ | 333 | [ |
253 | CompletionItem { | 334 | CompletionItem { |
254 | label: "Clone", | 335 | label: "Clone", |
255 | source_range: 30..30, | 336 | source_range: 9..9, |
256 | delete: 30..30, | 337 | delete: 9..9, |
257 | insert: "Clone", | 338 | insert: "Clone", |
258 | kind: Attribute, | 339 | kind: Attribute, |
259 | }, | 340 | }, |
260 | CompletionItem { | 341 | CompletionItem { |
261 | label: "Copy, Clone", | 342 | label: "Copy, Clone", |
262 | source_range: 30..30, | 343 | source_range: 9..9, |
263 | delete: 30..30, | 344 | delete: 9..9, |
264 | insert: "Copy, Clone", | 345 | insert: "Copy, Clone", |
265 | kind: Attribute, | 346 | kind: Attribute, |
266 | }, | 347 | }, |
267 | CompletionItem { | 348 | CompletionItem { |
268 | label: "Debug", | 349 | label: "Debug", |
269 | source_range: 30..30, | 350 | source_range: 9..9, |
270 | delete: 30..30, | 351 | delete: 9..9, |
271 | insert: "Debug", | 352 | insert: "Debug", |
272 | kind: Attribute, | 353 | kind: Attribute, |
273 | }, | 354 | }, |
274 | CompletionItem { | 355 | CompletionItem { |
275 | label: "Default", | 356 | label: "Default", |
276 | source_range: 30..30, | 357 | source_range: 9..9, |
277 | delete: 30..30, | 358 | delete: 9..9, |
278 | insert: "Default", | 359 | insert: "Default", |
279 | kind: Attribute, | 360 | kind: Attribute, |
280 | }, | 361 | }, |
281 | CompletionItem { | 362 | CompletionItem { |
282 | label: "Eq, PartialEq", | 363 | label: "Eq, PartialEq", |
283 | source_range: 30..30, | 364 | source_range: 9..9, |
284 | delete: 30..30, | 365 | delete: 9..9, |
285 | insert: "Eq, PartialEq", | 366 | insert: "Eq, PartialEq", |
286 | kind: Attribute, | 367 | kind: Attribute, |
287 | }, | 368 | }, |
288 | CompletionItem { | 369 | CompletionItem { |
289 | label: "Hash", | 370 | label: "Hash", |
290 | source_range: 30..30, | 371 | source_range: 9..9, |
291 | delete: 30..30, | 372 | delete: 9..9, |
292 | insert: "Hash", | 373 | insert: "Hash", |
293 | kind: Attribute, | 374 | kind: Attribute, |
294 | }, | 375 | }, |
295 | CompletionItem { | 376 | CompletionItem { |
296 | label: "Ord, PartialOrd, Eq, PartialEq", | 377 | label: "Ord, PartialOrd, Eq, PartialEq", |
297 | source_range: 30..30, | 378 | source_range: 9..9, |
298 | delete: 30..30, | 379 | delete: 9..9, |
299 | insert: "Ord, PartialOrd, Eq, PartialEq", | 380 | insert: "Ord, PartialOrd, Eq, PartialEq", |
300 | kind: Attribute, | 381 | kind: Attribute, |
301 | }, | 382 | }, |
302 | CompletionItem { | 383 | CompletionItem { |
303 | label: "PartialEq", | 384 | label: "PartialEq", |
304 | source_range: 30..30, | 385 | source_range: 9..9, |
305 | delete: 30..30, | 386 | delete: 9..9, |
306 | insert: "PartialEq", | 387 | insert: "PartialEq", |
307 | kind: Attribute, | 388 | kind: Attribute, |
308 | }, | 389 | }, |
309 | CompletionItem { | 390 | CompletionItem { |
310 | label: "PartialOrd, PartialEq", | 391 | label: "PartialOrd, PartialEq", |
311 | source_range: 30..30, | 392 | source_range: 9..9, |
312 | delete: 30..30, | 393 | delete: 9..9, |
313 | insert: "PartialOrd, PartialEq", | 394 | insert: "PartialOrd, PartialEq", |
314 | kind: Attribute, | 395 | kind: Attribute, |
315 | }, | 396 | }, |
316 | ] | 397 | ] |
317 | "### | 398 | "### |
318 | ); | 399 | ); |
319 | } | 400 | } |
320 | 401 | ||
@@ -344,62 +425,62 @@ mod tests { | |||
344 | [ | 425 | [ |
345 | CompletionItem { | 426 | CompletionItem { |
346 | label: "Clone", | 427 | label: "Clone", |
347 | source_range: 59..59, | 428 | source_range: 38..38, |
348 | delete: 59..59, | 429 | delete: 38..38, |
349 | insert: "Clone", | 430 | insert: "Clone", |
350 | kind: Attribute, | 431 | kind: Attribute, |
351 | }, | 432 | }, |
352 | CompletionItem { | 433 | CompletionItem { |
353 | label: "Copy, Clone", | 434 | label: "Copy, Clone", |
354 | source_range: 59..59, | 435 | source_range: 38..38, |
355 | delete: 59..59, | 436 | delete: 38..38, |
356 | insert: "Copy, Clone", | 437 | insert: "Copy, Clone", |
357 | kind: Attribute, | 438 | kind: Attribute, |
358 | }, | 439 | }, |
359 | CompletionItem { | 440 | CompletionItem { |
360 | label: "Debug", | 441 | label: "Debug", |
361 | source_range: 59..59, | 442 | source_range: 38..38, |
362 | delete: 59..59, | 443 | delete: 38..38, |
363 | insert: "Debug", | 444 | insert: "Debug", |
364 | kind: Attribute, | 445 | kind: Attribute, |
365 | }, | 446 | }, |
366 | CompletionItem { | 447 | CompletionItem { |
367 | label: "Default", | 448 | label: "Default", |
368 | source_range: 59..59, | 449 | source_range: 38..38, |
369 | delete: 59..59, | 450 | delete: 38..38, |
370 | insert: "Default", | 451 | insert: "Default", |
371 | kind: Attribute, | 452 | kind: Attribute, |
372 | }, | 453 | }, |
373 | CompletionItem { | 454 | CompletionItem { |
374 | label: "Eq", | 455 | label: "Eq", |
375 | source_range: 59..59, | 456 | source_range: 38..38, |
376 | delete: 59..59, | 457 | delete: 38..38, |
377 | insert: "Eq", | 458 | insert: "Eq", |
378 | kind: Attribute, | 459 | kind: Attribute, |
379 | }, | 460 | }, |
380 | CompletionItem { | 461 | CompletionItem { |
381 | label: "Hash", | 462 | label: "Hash", |
382 | source_range: 59..59, | 463 | source_range: 38..38, |
383 | delete: 59..59, | 464 | delete: 38..38, |
384 | insert: "Hash", | 465 | insert: "Hash", |
385 | kind: Attribute, | 466 | kind: Attribute, |
386 | }, | 467 | }, |
387 | CompletionItem { | 468 | CompletionItem { |
388 | label: "Ord, PartialOrd, Eq", | 469 | label: "Ord, PartialOrd, Eq", |
389 | source_range: 59..59, | 470 | source_range: 38..38, |
390 | delete: 59..59, | 471 | delete: 38..38, |
391 | insert: "Ord, PartialOrd, Eq", | 472 | insert: "Ord, PartialOrd, Eq", |
392 | kind: Attribute, | 473 | kind: Attribute, |
393 | }, | 474 | }, |
394 | CompletionItem { | 475 | CompletionItem { |
395 | label: "PartialOrd", | 476 | label: "PartialOrd", |
396 | source_range: 59..59, | 477 | source_range: 38..38, |
397 | delete: 59..59, | 478 | delete: 38..38, |
398 | insert: "PartialOrd", | 479 | insert: "PartialOrd", |
399 | kind: Attribute, | 480 | kind: Attribute, |
400 | }, | 481 | }, |
401 | ] | 482 | ] |
402 | "### | 483 | "### |
403 | ); | 484 | ); |
404 | } | 485 | } |
405 | 486 | ||
@@ -414,193 +495,211 @@ mod tests { | |||
414 | @r###" | 495 | @r###" |
415 | [ | 496 | [ |
416 | CompletionItem { | 497 | CompletionItem { |
417 | label: "allow", | 498 | label: "allow(…)", |
418 | source_range: 19..19, | 499 | source_range: 2..2, |
419 | delete: 19..19, | 500 | delete: 2..2, |
420 | insert: "allow(${0:lint})", | 501 | insert: "allow(${0:lint})", |
421 | kind: Attribute, | 502 | kind: Attribute, |
503 | lookup: "allow", | ||
422 | }, | 504 | }, |
423 | CompletionItem { | 505 | CompletionItem { |
424 | label: "cfg", | 506 | label: "cfg(…)", |
425 | source_range: 19..19, | 507 | source_range: 2..2, |
426 | delete: 19..19, | 508 | delete: 2..2, |
427 | insert: "cfg(${0:predicate})", | 509 | insert: "cfg(${0:predicate})", |
428 | kind: Attribute, | 510 | kind: Attribute, |
511 | lookup: "cfg", | ||
429 | }, | 512 | }, |
430 | CompletionItem { | 513 | CompletionItem { |
431 | label: "cfg_attr", | 514 | label: "cfg_attr(…)", |
432 | source_range: 19..19, | 515 | source_range: 2..2, |
433 | delete: 19..19, | 516 | delete: 2..2, |
434 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 517 | insert: "cfg_attr(${1:predicate}, ${0:attr})", |
435 | kind: Attribute, | 518 | kind: Attribute, |
519 | lookup: "cfg_attr", | ||
436 | }, | 520 | }, |
437 | CompletionItem { | 521 | CompletionItem { |
438 | label: "deny", | 522 | label: "deny(…)", |
439 | source_range: 19..19, | 523 | source_range: 2..2, |
440 | delete: 19..19, | 524 | delete: 2..2, |
441 | insert: "deny(${0:lint})", | 525 | insert: "deny(${0:lint})", |
442 | kind: Attribute, | 526 | kind: Attribute, |
527 | lookup: "deny", | ||
443 | }, | 528 | }, |
444 | CompletionItem { | 529 | CompletionItem { |
445 | label: "deprecated", | 530 | label: "deprecated = \"…\"", |
446 | source_range: 19..19, | 531 | source_range: 2..2, |
447 | delete: 19..19, | 532 | delete: 2..2, |
448 | insert: "deprecated = \"${0:reason}\"", | 533 | insert: "deprecated = \"${0:reason}\"", |
449 | kind: Attribute, | 534 | kind: Attribute, |
535 | lookup: "deprecated", | ||
450 | }, | 536 | }, |
451 | CompletionItem { | 537 | CompletionItem { |
452 | label: "derive", | 538 | label: "derive(…)", |
453 | source_range: 19..19, | 539 | source_range: 2..2, |
454 | delete: 19..19, | 540 | delete: 2..2, |
455 | insert: "derive(${0:Debug})", | 541 | insert: "derive(${0:Debug})", |
456 | kind: Attribute, | 542 | kind: Attribute, |
543 | lookup: "derive", | ||
457 | }, | 544 | }, |
458 | CompletionItem { | 545 | CompletionItem { |
459 | label: "doc", | 546 | label: "doc = \"…\"", |
460 | source_range: 19..19, | 547 | source_range: 2..2, |
461 | delete: 19..19, | 548 | delete: 2..2, |
462 | insert: "doc = \"${0:docs}\"", | 549 | insert: "doc = \"${0:docs}\"", |
463 | kind: Attribute, | 550 | kind: Attribute, |
551 | lookup: "doc", | ||
464 | }, | 552 | }, |
465 | CompletionItem { | 553 | CompletionItem { |
466 | label: "forbid", | 554 | label: "forbid(…)", |
467 | source_range: 19..19, | 555 | source_range: 2..2, |
468 | delete: 19..19, | 556 | delete: 2..2, |
469 | insert: "forbid(${0:lint})", | 557 | insert: "forbid(${0:lint})", |
470 | kind: Attribute, | 558 | kind: Attribute, |
559 | lookup: "forbid", | ||
471 | }, | 560 | }, |
472 | CompletionItem { | 561 | CompletionItem { |
473 | label: "ignore", | 562 | label: "ignore(…)", |
474 | source_range: 19..19, | 563 | source_range: 2..2, |
475 | delete: 19..19, | 564 | delete: 2..2, |
476 | insert: "ignore(${0:lint})", | 565 | insert: "ignore(${0:lint})", |
477 | kind: Attribute, | 566 | kind: Attribute, |
567 | lookup: "ignore", | ||
478 | }, | 568 | }, |
479 | CompletionItem { | 569 | CompletionItem { |
480 | label: "inline", | 570 | label: "inline(…)", |
481 | source_range: 19..19, | 571 | source_range: 2..2, |
482 | delete: 19..19, | 572 | delete: 2..2, |
483 | insert: "inline(${0:lint})", | 573 | insert: "inline(${0:lint})", |
484 | kind: Attribute, | 574 | kind: Attribute, |
575 | lookup: "inline", | ||
485 | }, | 576 | }, |
486 | CompletionItem { | 577 | CompletionItem { |
487 | label: "link", | 578 | label: "link", |
488 | source_range: 19..19, | 579 | source_range: 2..2, |
489 | delete: 19..19, | 580 | delete: 2..2, |
490 | insert: "link", | 581 | insert: "link", |
491 | kind: Attribute, | 582 | kind: Attribute, |
492 | }, | 583 | }, |
493 | CompletionItem { | 584 | CompletionItem { |
494 | label: "link_name", | 585 | label: "link_name = \"…\"", |
495 | source_range: 19..19, | 586 | source_range: 2..2, |
496 | delete: 19..19, | 587 | delete: 2..2, |
497 | insert: "link_name = \"${0:symbol_name}\"", | 588 | insert: "link_name = \"${0:symbol_name}\"", |
498 | kind: Attribute, | 589 | kind: Attribute, |
590 | lookup: "link_name", | ||
499 | }, | 591 | }, |
500 | CompletionItem { | 592 | CompletionItem { |
501 | label: "macro_export", | 593 | label: "macro_export", |
502 | source_range: 19..19, | 594 | source_range: 2..2, |
503 | delete: 19..19, | 595 | delete: 2..2, |
504 | insert: "macro_export", | 596 | insert: "macro_export", |
505 | kind: Attribute, | 597 | kind: Attribute, |
506 | }, | 598 | }, |
507 | CompletionItem { | 599 | CompletionItem { |
508 | label: "macro_use", | 600 | label: "macro_use", |
509 | source_range: 19..19, | 601 | source_range: 2..2, |
510 | delete: 19..19, | 602 | delete: 2..2, |
511 | insert: "macro_use", | 603 | insert: "macro_use", |
512 | kind: Attribute, | 604 | kind: Attribute, |
513 | }, | 605 | }, |
514 | CompletionItem { | 606 | CompletionItem { |
515 | label: "must_use", | 607 | label: "must_use = \"…\"", |
516 | source_range: 19..19, | 608 | source_range: 2..2, |
517 | delete: 19..19, | 609 | delete: 2..2, |
518 | insert: "must_use = \"${0:reason}\"", | 610 | insert: "must_use = \"${0:reason}\"", |
519 | kind: Attribute, | 611 | kind: Attribute, |
612 | lookup: "must_use", | ||
520 | }, | 613 | }, |
521 | CompletionItem { | 614 | CompletionItem { |
522 | label: "no_mangle", | 615 | label: "no_mangle", |
523 | source_range: 19..19, | 616 | source_range: 2..2, |
524 | delete: 19..19, | 617 | delete: 2..2, |
525 | insert: "no_mangle", | 618 | insert: "no_mangle", |
526 | kind: Attribute, | 619 | kind: Attribute, |
527 | }, | 620 | }, |
528 | CompletionItem { | 621 | CompletionItem { |
529 | label: "non_exhaustive", | 622 | label: "non_exhaustive", |
530 | source_range: 19..19, | 623 | source_range: 2..2, |
531 | delete: 19..19, | 624 | delete: 2..2, |
532 | insert: "non_exhaustive", | 625 | insert: "non_exhaustive", |
533 | kind: Attribute, | 626 | kind: Attribute, |
534 | }, | 627 | }, |
535 | CompletionItem { | 628 | CompletionItem { |
536 | label: "path", | 629 | label: "path = \"…\"", |
537 | source_range: 19..19, | 630 | source_range: 2..2, |
538 | delete: 19..19, | 631 | delete: 2..2, |
539 | insert: "path =\"${0:path}\"", | 632 | insert: "path =\"${0:path}\"", |
540 | kind: Attribute, | 633 | kind: Attribute, |
634 | lookup: "path", | ||
541 | }, | 635 | }, |
542 | CompletionItem { | 636 | CompletionItem { |
543 | label: "proc_macro", | 637 | label: "proc_macro", |
544 | source_range: 19..19, | 638 | source_range: 2..2, |
545 | delete: 19..19, | 639 | delete: 2..2, |
546 | insert: "proc_macro", | 640 | insert: "proc_macro", |
547 | kind: Attribute, | 641 | kind: Attribute, |
548 | }, | 642 | }, |
549 | CompletionItem { | 643 | CompletionItem { |
550 | label: "proc_macro_attribute", | 644 | label: "proc_macro_attribute", |
551 | source_range: 19..19, | 645 | source_range: 2..2, |
552 | delete: 19..19, | 646 | delete: 2..2, |
553 | insert: "proc_macro_attribute", | 647 | insert: "proc_macro_attribute", |
554 | kind: Attribute, | 648 | kind: Attribute, |
555 | }, | 649 | }, |
556 | CompletionItem { | 650 | CompletionItem { |
557 | label: "proc_macro_derive", | 651 | label: "proc_macro_derive(…)", |
558 | source_range: 19..19, | 652 | source_range: 2..2, |
559 | delete: 19..19, | 653 | delete: 2..2, |
560 | insert: "proc_macro_derive(${0:Trait})", | 654 | insert: "proc_macro_derive(${0:Trait})", |
561 | kind: Attribute, | 655 | kind: Attribute, |
656 | lookup: "proc_macro_derive", | ||
562 | }, | 657 | }, |
563 | CompletionItem { | 658 | CompletionItem { |
564 | label: "repr", | 659 | label: "repr(…)", |
565 | source_range: 19..19, | 660 | source_range: 2..2, |
566 | delete: 19..19, | 661 | delete: 2..2, |
567 | insert: "repr(${0:C})", | 662 | insert: "repr(${0:C})", |
568 | kind: Attribute, | 663 | kind: Attribute, |
664 | lookup: "repr", | ||
569 | }, | 665 | }, |
570 | CompletionItem { | 666 | CompletionItem { |
571 | label: "should_panic", | 667 | label: "should_panic(…)", |
572 | source_range: 19..19, | 668 | source_range: 2..2, |
573 | delete: 19..19, | 669 | delete: 2..2, |
574 | insert: "should_panic(expected = \"${0:reason}\")", | 670 | insert: "should_panic(expected = \"${0:reason}\")", |
575 | kind: Attribute, | 671 | kind: Attribute, |
672 | lookup: "should_panic", | ||
576 | }, | 673 | }, |
577 | CompletionItem { | 674 | CompletionItem { |
578 | label: "target_feature", | 675 | label: "target_feature = \"…\"", |
579 | source_range: 19..19, | 676 | source_range: 2..2, |
580 | delete: 19..19, | 677 | delete: 2..2, |
581 | insert: "target_feature = \"${0:feature}\"", | 678 | insert: "target_feature = \"${0:feature}\"", |
582 | kind: Attribute, | 679 | kind: Attribute, |
680 | lookup: "target_feature", | ||
583 | }, | 681 | }, |
584 | CompletionItem { | 682 | CompletionItem { |
585 | label: "test", | 683 | label: "test", |
586 | source_range: 19..19, | 684 | source_range: 2..2, |
587 | delete: 19..19, | 685 | delete: 2..2, |
588 | insert: "test", | 686 | insert: "test", |
589 | kind: Attribute, | 687 | kind: Attribute, |
590 | }, | 688 | }, |
591 | CompletionItem { | 689 | CompletionItem { |
592 | label: "used", | 690 | label: "used", |
593 | source_range: 19..19, | 691 | source_range: 2..2, |
594 | delete: 19..19, | 692 | delete: 2..2, |
595 | insert: "used", | 693 | insert: "used", |
596 | kind: Attribute, | 694 | kind: Attribute, |
597 | }, | 695 | }, |
598 | CompletionItem { | 696 | CompletionItem { |
599 | label: "warn", | 697 | label: "warn(…)", |
600 | source_range: 19..19, | 698 | source_range: 2..2, |
601 | delete: 19..19, | 699 | delete: 2..2, |
602 | insert: "warn(${0:lint})", | 700 | insert: "warn(${0:lint})", |
603 | kind: Attribute, | 701 | kind: Attribute, |
702 | lookup: "warn", | ||
604 | }, | 703 | }, |
605 | ] | 704 | ] |
606 | "### | 705 | "### |
@@ -608,6 +707,20 @@ mod tests { | |||
608 | } | 707 | } |
609 | 708 | ||
610 | #[test] | 709 | #[test] |
710 | fn test_attribute_completion_inside_nested_attr() { | ||
711 | assert_debug_snapshot!( | ||
712 | do_attr_completion( | ||
713 | r" | ||
714 | #[allow(<|>)] | ||
715 | ", | ||
716 | ), | ||
717 | @r###" | ||
718 | [] | ||
719 | "### | ||
720 | ); | ||
721 | } | ||
722 | |||
723 | #[test] | ||
611 | fn test_inner_attribute_completion() { | 724 | fn test_inner_attribute_completion() { |
612 | assert_debug_snapshot!( | 725 | assert_debug_snapshot!( |
613 | do_attr_completion( | 726 | do_attr_completion( |
@@ -618,235 +731,256 @@ mod tests { | |||
618 | @r###" | 731 | @r###" |
619 | [ | 732 | [ |
620 | CompletionItem { | 733 | CompletionItem { |
621 | label: "allow", | 734 | label: "allow(…)", |
622 | source_range: 20..20, | 735 | source_range: 3..3, |
623 | delete: 20..20, | 736 | delete: 3..3, |
624 | insert: "allow(${0:lint})", | 737 | insert: "allow(${0:lint})", |
625 | kind: Attribute, | 738 | kind: Attribute, |
739 | lookup: "allow", | ||
626 | }, | 740 | }, |
627 | CompletionItem { | 741 | CompletionItem { |
628 | label: "cfg", | 742 | label: "cfg(…)", |
629 | source_range: 20..20, | 743 | source_range: 3..3, |
630 | delete: 20..20, | 744 | delete: 3..3, |
631 | insert: "cfg(${0:predicate})", | 745 | insert: "cfg(${0:predicate})", |
632 | kind: Attribute, | 746 | kind: Attribute, |
747 | lookup: "cfg", | ||
633 | }, | 748 | }, |
634 | CompletionItem { | 749 | CompletionItem { |
635 | label: "cfg_attr", | 750 | label: "cfg_attr(…)", |
636 | source_range: 20..20, | 751 | source_range: 3..3, |
637 | delete: 20..20, | 752 | delete: 3..3, |
638 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 753 | insert: "cfg_attr(${1:predicate}, ${0:attr})", |
639 | kind: Attribute, | 754 | kind: Attribute, |
755 | lookup: "cfg_attr", | ||
640 | }, | 756 | }, |
641 | CompletionItem { | 757 | CompletionItem { |
642 | label: "deny", | 758 | label: "deny(…)", |
643 | source_range: 20..20, | 759 | source_range: 3..3, |
644 | delete: 20..20, | 760 | delete: 3..3, |
645 | insert: "deny(${0:lint})", | 761 | insert: "deny(${0:lint})", |
646 | kind: Attribute, | 762 | kind: Attribute, |
763 | lookup: "deny", | ||
647 | }, | 764 | }, |
648 | CompletionItem { | 765 | CompletionItem { |
649 | label: "deprecated", | 766 | label: "deprecated = \"…\"", |
650 | source_range: 20..20, | 767 | source_range: 3..3, |
651 | delete: 20..20, | 768 | delete: 3..3, |
652 | insert: "deprecated = \"${0:reason}\"", | 769 | insert: "deprecated = \"${0:reason}\"", |
653 | kind: Attribute, | 770 | kind: Attribute, |
771 | lookup: "deprecated", | ||
654 | }, | 772 | }, |
655 | CompletionItem { | 773 | CompletionItem { |
656 | label: "derive", | 774 | label: "derive(…)", |
657 | source_range: 20..20, | 775 | source_range: 3..3, |
658 | delete: 20..20, | 776 | delete: 3..3, |
659 | insert: "derive(${0:Debug})", | 777 | insert: "derive(${0:Debug})", |
660 | kind: Attribute, | 778 | kind: Attribute, |
779 | lookup: "derive", | ||
661 | }, | 780 | }, |
662 | CompletionItem { | 781 | CompletionItem { |
663 | label: "doc", | 782 | label: "doc = \"…\"", |
664 | source_range: 20..20, | 783 | source_range: 3..3, |
665 | delete: 20..20, | 784 | delete: 3..3, |
666 | insert: "doc = \"${0:docs}\"", | 785 | insert: "doc = \"${0:docs}\"", |
667 | kind: Attribute, | 786 | kind: Attribute, |
787 | lookup: "doc", | ||
668 | }, | 788 | }, |
669 | CompletionItem { | 789 | CompletionItem { |
670 | label: "feature", | 790 | label: "feature(…)", |
671 | source_range: 20..20, | 791 | source_range: 3..3, |
672 | delete: 20..20, | 792 | delete: 3..3, |
673 | insert: "feature(${0:flag})", | 793 | insert: "feature(${0:flag})", |
674 | kind: Attribute, | 794 | kind: Attribute, |
795 | lookup: "feature", | ||
675 | }, | 796 | }, |
676 | CompletionItem { | 797 | CompletionItem { |
677 | label: "forbid", | 798 | label: "forbid(…)", |
678 | source_range: 20..20, | 799 | source_range: 3..3, |
679 | delete: 20..20, | 800 | delete: 3..3, |
680 | insert: "forbid(${0:lint})", | 801 | insert: "forbid(${0:lint})", |
681 | kind: Attribute, | 802 | kind: Attribute, |
803 | lookup: "forbid", | ||
682 | }, | 804 | }, |
683 | CompletionItem { | 805 | CompletionItem { |
684 | label: "global_allocator", | 806 | label: "global_allocator", |
685 | source_range: 20..20, | 807 | source_range: 3..3, |
686 | delete: 20..20, | 808 | delete: 3..3, |
687 | insert: "global_allocator", | 809 | insert: "global_allocator", |
688 | kind: Attribute, | 810 | kind: Attribute, |
689 | }, | 811 | }, |
690 | CompletionItem { | 812 | CompletionItem { |
691 | label: "ignore", | 813 | label: "ignore(…)", |
692 | source_range: 20..20, | 814 | source_range: 3..3, |
693 | delete: 20..20, | 815 | delete: 3..3, |
694 | insert: "ignore(${0:lint})", | 816 | insert: "ignore(${0:lint})", |
695 | kind: Attribute, | 817 | kind: Attribute, |
818 | lookup: "ignore", | ||
696 | }, | 819 | }, |
697 | CompletionItem { | 820 | CompletionItem { |
698 | label: "inline", | 821 | label: "inline(…)", |
699 | source_range: 20..20, | 822 | source_range: 3..3, |
700 | delete: 20..20, | 823 | delete: 3..3, |
701 | insert: "inline(${0:lint})", | 824 | insert: "inline(${0:lint})", |
702 | kind: Attribute, | 825 | kind: Attribute, |
826 | lookup: "inline", | ||
703 | }, | 827 | }, |
704 | CompletionItem { | 828 | CompletionItem { |
705 | label: "link", | 829 | label: "link", |
706 | source_range: 20..20, | 830 | source_range: 3..3, |
707 | delete: 20..20, | 831 | delete: 3..3, |
708 | insert: "link", | 832 | insert: "link", |
709 | kind: Attribute, | 833 | kind: Attribute, |
710 | }, | 834 | }, |
711 | CompletionItem { | 835 | CompletionItem { |
712 | label: "link_name", | 836 | label: "link_name = \"…\"", |
713 | source_range: 20..20, | 837 | source_range: 3..3, |
714 | delete: 20..20, | 838 | delete: 3..3, |
715 | insert: "link_name = \"${0:symbol_name}\"", | 839 | insert: "link_name = \"${0:symbol_name}\"", |
716 | kind: Attribute, | 840 | kind: Attribute, |
841 | lookup: "link_name", | ||
717 | }, | 842 | }, |
718 | CompletionItem { | 843 | CompletionItem { |
719 | label: "macro_export", | 844 | label: "macro_export", |
720 | source_range: 20..20, | 845 | source_range: 3..3, |
721 | delete: 20..20, | 846 | delete: 3..3, |
722 | insert: "macro_export", | 847 | insert: "macro_export", |
723 | kind: Attribute, | 848 | kind: Attribute, |
724 | }, | 849 | }, |
725 | CompletionItem { | 850 | CompletionItem { |
726 | label: "macro_use", | 851 | label: "macro_use", |
727 | source_range: 20..20, | 852 | source_range: 3..3, |
728 | delete: 20..20, | 853 | delete: 3..3, |
729 | insert: "macro_use", | 854 | insert: "macro_use", |
730 | kind: Attribute, | 855 | kind: Attribute, |
731 | }, | 856 | }, |
732 | CompletionItem { | 857 | CompletionItem { |
733 | label: "must_use", | 858 | label: "must_use = \"…\"", |
734 | source_range: 20..20, | 859 | source_range: 3..3, |
735 | delete: 20..20, | 860 | delete: 3..3, |
736 | insert: "must_use = \"${0:reason}\"", | 861 | insert: "must_use = \"${0:reason}\"", |
737 | kind: Attribute, | 862 | kind: Attribute, |
863 | lookup: "must_use", | ||
738 | }, | 864 | }, |
739 | CompletionItem { | 865 | CompletionItem { |
740 | label: "no_mangle", | 866 | label: "no_mangle", |
741 | source_range: 20..20, | 867 | source_range: 3..3, |
742 | delete: 20..20, | 868 | delete: 3..3, |
743 | insert: "no_mangle", | 869 | insert: "no_mangle", |
744 | kind: Attribute, | 870 | kind: Attribute, |
745 | }, | 871 | }, |
746 | CompletionItem { | 872 | CompletionItem { |
747 | label: "no_std", | 873 | label: "no_std", |
748 | source_range: 20..20, | 874 | source_range: 3..3, |
749 | delete: 20..20, | 875 | delete: 3..3, |
750 | insert: "no_std", | 876 | insert: "no_std", |
751 | kind: Attribute, | 877 | kind: Attribute, |
752 | }, | 878 | }, |
753 | CompletionItem { | 879 | CompletionItem { |
754 | label: "non_exhaustive", | 880 | label: "non_exhaustive", |
755 | source_range: 20..20, | 881 | source_range: 3..3, |
756 | delete: 20..20, | 882 | delete: 3..3, |
757 | insert: "non_exhaustive", | 883 | insert: "non_exhaustive", |
758 | kind: Attribute, | 884 | kind: Attribute, |
759 | }, | 885 | }, |
760 | CompletionItem { | 886 | CompletionItem { |
761 | label: "panic_handler", | 887 | label: "panic_handler", |
762 | source_range: 20..20, | 888 | source_range: 3..3, |
763 | delete: 20..20, | 889 | delete: 3..3, |
764 | insert: "panic_handler", | 890 | insert: "panic_handler", |
765 | kind: Attribute, | 891 | kind: Attribute, |
766 | }, | 892 | }, |
767 | CompletionItem { | 893 | CompletionItem { |
768 | label: "path", | 894 | label: "path = \"…\"", |
769 | source_range: 20..20, | 895 | source_range: 3..3, |
770 | delete: 20..20, | 896 | delete: 3..3, |
771 | insert: "path =\"${0:path}\"", | 897 | insert: "path =\"${0:path}\"", |
772 | kind: Attribute, | 898 | kind: Attribute, |
899 | lookup: "path", | ||
773 | }, | 900 | }, |
774 | CompletionItem { | 901 | CompletionItem { |
775 | label: "proc_macro", | 902 | label: "proc_macro", |
776 | source_range: 20..20, | 903 | source_range: 3..3, |
777 | delete: 20..20, | 904 | delete: 3..3, |
778 | insert: "proc_macro", | 905 | insert: "proc_macro", |
779 | kind: Attribute, | 906 | kind: Attribute, |
780 | }, | 907 | }, |
781 | CompletionItem { | 908 | CompletionItem { |
782 | label: "proc_macro_attribute", | 909 | label: "proc_macro_attribute", |
783 | source_range: 20..20, | 910 | source_range: 3..3, |
784 | delete: 20..20, | 911 | delete: 3..3, |
785 | insert: "proc_macro_attribute", | 912 | insert: "proc_macro_attribute", |
786 | kind: Attribute, | 913 | kind: Attribute, |
787 | }, | 914 | }, |
788 | CompletionItem { | 915 | CompletionItem { |
789 | label: "proc_macro_derive", | 916 | label: "proc_macro_derive(…)", |
790 | source_range: 20..20, | 917 | source_range: 3..3, |
791 | delete: 20..20, | 918 | delete: 3..3, |
792 | insert: "proc_macro_derive(${0:Trait})", | 919 | insert: "proc_macro_derive(${0:Trait})", |
793 | kind: Attribute, | 920 | kind: Attribute, |
921 | lookup: "proc_macro_derive", | ||
794 | }, | 922 | }, |
795 | CompletionItem { | 923 | CompletionItem { |
796 | label: "recursion_limit", | 924 | label: "recursion_limit = …", |
797 | source_range: 20..20, | 925 | source_range: 3..3, |
798 | delete: 20..20, | 926 | delete: 3..3, |
799 | insert: "recursion_limit = ${0:128}", | 927 | insert: "recursion_limit = ${0:128}", |
800 | kind: Attribute, | 928 | kind: Attribute, |
929 | lookup: "recursion_limit", | ||
801 | }, | 930 | }, |
802 | CompletionItem { | 931 | CompletionItem { |
803 | label: "repr", | 932 | label: "repr(…)", |
804 | source_range: 20..20, | 933 | source_range: 3..3, |
805 | delete: 20..20, | 934 | delete: 3..3, |
806 | insert: "repr(${0:C})", | 935 | insert: "repr(${0:C})", |
807 | kind: Attribute, | 936 | kind: Attribute, |
937 | lookup: "repr", | ||
808 | }, | 938 | }, |
809 | CompletionItem { | 939 | CompletionItem { |
810 | label: "should_panic", | 940 | label: "should_panic(…)", |
811 | source_range: 20..20, | 941 | source_range: 3..3, |
812 | delete: 20..20, | 942 | delete: 3..3, |
813 | insert: "should_panic(expected = \"${0:reason}\")", | 943 | insert: "should_panic(expected = \"${0:reason}\")", |
814 | kind: Attribute, | 944 | kind: Attribute, |
945 | lookup: "should_panic", | ||
815 | }, | 946 | }, |
816 | CompletionItem { | 947 | CompletionItem { |
817 | label: "target_feature", | 948 | label: "target_feature = \"…\"", |
818 | source_range: 20..20, | 949 | source_range: 3..3, |
819 | delete: 20..20, | 950 | delete: 3..3, |
820 | insert: "target_feature = \"${0:feature}\"", | 951 | insert: "target_feature = \"${0:feature}\"", |
821 | kind: Attribute, | 952 | kind: Attribute, |
953 | lookup: "target_feature", | ||
822 | }, | 954 | }, |
823 | CompletionItem { | 955 | CompletionItem { |
824 | label: "test", | 956 | label: "test", |
825 | source_range: 20..20, | 957 | source_range: 3..3, |
826 | delete: 20..20, | 958 | delete: 3..3, |
827 | insert: "test", | 959 | insert: "test", |
828 | kind: Attribute, | 960 | kind: Attribute, |
829 | }, | 961 | }, |
830 | CompletionItem { | 962 | CompletionItem { |
831 | label: "used", | 963 | label: "used", |
832 | source_range: 20..20, | 964 | source_range: 3..3, |
833 | delete: 20..20, | 965 | delete: 3..3, |
834 | insert: "used", | 966 | insert: "used", |
835 | kind: Attribute, | 967 | kind: Attribute, |
836 | }, | 968 | }, |
837 | CompletionItem { | 969 | CompletionItem { |
838 | label: "warn", | 970 | label: "warn(…)", |
839 | source_range: 20..20, | 971 | source_range: 3..3, |
840 | delete: 20..20, | 972 | delete: 3..3, |
841 | insert: "warn(${0:lint})", | 973 | insert: "warn(${0:lint})", |
842 | kind: Attribute, | 974 | kind: Attribute, |
975 | lookup: "warn", | ||
843 | }, | 976 | }, |
844 | CompletionItem { | 977 | CompletionItem { |
845 | label: "windows_subsystem", | 978 | label: "windows_subsystem = \"…\"", |
846 | source_range: 20..20, | 979 | source_range: 3..3, |
847 | delete: 20..20, | 980 | delete: 3..3, |
848 | insert: "windows_subsystem = \"${0:subsystem}\"", | 981 | insert: "windows_subsystem = \"${0:subsystem}\"", |
849 | kind: Attribute, | 982 | kind: Attribute, |
983 | lookup: "windows_subsystem", | ||
850 | }, | 984 | }, |
851 | ] | 985 | ] |
852 | "### | 986 | "### |