diff options
author | Aleksey Kladov <[email protected]> | 2020-07-03 14:46:37 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-03 14:59:37 +0100 |
commit | 314efae29d42d2adae990e70eb4ccbaa141a5a06 (patch) | |
tree | 60bfbc480b136e58b3ccca8364db9c7fdfadec59 | |
parent | f1671f460ba3a44baa49ca7413646f84f86be842 (diff) |
Refactor attribut completion tests
-rw-r--r-- | crates/ra_ide/src/completion/complete_attribute.rs | 760 |
1 files changed, 115 insertions, 645 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index 4e50a294f..9db317509 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs | |||
@@ -226,677 +226,147 @@ const DEFAULT_DERIVE_COMPLETIONS: &[DeriveCompletion] = &[ | |||
226 | 226 | ||
227 | #[cfg(test)] | 227 | #[cfg(test)] |
228 | mod tests { | 228 | mod tests { |
229 | use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind}; | 229 | use expect::{expect, Expect}; |
230 | use insta::assert_debug_snapshot; | ||
231 | 230 | ||
232 | fn do_attr_completion(code: &str) -> Vec<CompletionItem> { | 231 | use crate::completion::{test_utils::completion_list, CompletionKind}; |
233 | do_completion(code, CompletionKind::Attribute) | 232 | |
233 | fn check(ra_fixture: &str, expect: Expect) { | ||
234 | let actual = completion_list(ra_fixture, CompletionKind::Attribute); | ||
235 | expect.assert_eq(&actual); | ||
234 | } | 236 | } |
235 | 237 | ||
236 | #[test] | 238 | #[test] |
237 | fn empty_derive_completion() { | 239 | fn empty_derive_completion() { |
238 | assert_debug_snapshot!( | 240 | check( |
239 | do_attr_completion( | 241 | r#" |
240 | r" | 242 | #[derive(<|>)] |
241 | #[derive(<|>)] | 243 | struct Test {} |
242 | struct Test {} | 244 | "#, |
243 | ", | 245 | expect![[r#" |
244 | ), | 246 | at Clone |
245 | @r###" | 247 | at Copy, Clone |
246 | [ | 248 | at Debug |
247 | CompletionItem { | 249 | at Default |
248 | label: "Clone", | 250 | at Eq, PartialEq |
249 | source_range: 9..9, | 251 | at Hash |
250 | delete: 9..9, | 252 | at Ord, PartialOrd, Eq, PartialEq |
251 | insert: "Clone", | 253 | at PartialEq |
252 | kind: Attribute, | 254 | at PartialOrd, PartialEq |
253 | }, | 255 | "#]], |
254 | CompletionItem { | ||
255 | label: "Copy, Clone", | ||
256 | source_range: 9..9, | ||
257 | delete: 9..9, | ||
258 | insert: "Copy, Clone", | ||
259 | kind: Attribute, | ||
260 | }, | ||
261 | CompletionItem { | ||
262 | label: "Debug", | ||
263 | source_range: 9..9, | ||
264 | delete: 9..9, | ||
265 | insert: "Debug", | ||
266 | kind: Attribute, | ||
267 | }, | ||
268 | CompletionItem { | ||
269 | label: "Default", | ||
270 | source_range: 9..9, | ||
271 | delete: 9..9, | ||
272 | insert: "Default", | ||
273 | kind: Attribute, | ||
274 | }, | ||
275 | CompletionItem { | ||
276 | label: "Eq, PartialEq", | ||
277 | source_range: 9..9, | ||
278 | delete: 9..9, | ||
279 | insert: "Eq, PartialEq", | ||
280 | kind: Attribute, | ||
281 | }, | ||
282 | CompletionItem { | ||
283 | label: "Hash", | ||
284 | source_range: 9..9, | ||
285 | delete: 9..9, | ||
286 | insert: "Hash", | ||
287 | kind: Attribute, | ||
288 | }, | ||
289 | CompletionItem { | ||
290 | label: "Ord, PartialOrd, Eq, PartialEq", | ||
291 | source_range: 9..9, | ||
292 | delete: 9..9, | ||
293 | insert: "Ord, PartialOrd, Eq, PartialEq", | ||
294 | kind: Attribute, | ||
295 | }, | ||
296 | CompletionItem { | ||
297 | label: "PartialEq", | ||
298 | source_range: 9..9, | ||
299 | delete: 9..9, | ||
300 | insert: "PartialEq", | ||
301 | kind: Attribute, | ||
302 | }, | ||
303 | CompletionItem { | ||
304 | label: "PartialOrd, PartialEq", | ||
305 | source_range: 9..9, | ||
306 | delete: 9..9, | ||
307 | insert: "PartialOrd, PartialEq", | ||
308 | kind: Attribute, | ||
309 | }, | ||
310 | ] | ||
311 | "### | ||
312 | ); | 256 | ); |
313 | } | 257 | } |
314 | 258 | ||
315 | #[test] | 259 | #[test] |
316 | fn no_completion_for_incorrect_derive() { | 260 | fn no_completion_for_incorrect_derive() { |
317 | assert_debug_snapshot!( | 261 | check( |
318 | do_attr_completion( | 262 | r#" |
319 | r" | 263 | #[derive{<|>)] |
320 | #[derive{<|>)] | 264 | struct Test {} |
321 | struct Test {} | 265 | "#, |
322 | ", | 266 | expect![[r#""#]], |
323 | ), | 267 | ) |
324 | @"[]" | ||
325 | ); | ||
326 | } | 268 | } |
327 | 269 | ||
328 | #[test] | 270 | #[test] |
329 | fn derive_with_input_completion() { | 271 | fn derive_with_input_completion() { |
330 | assert_debug_snapshot!( | 272 | check( |
331 | do_attr_completion( | 273 | r#" |
332 | r" | 274 | #[derive(serde::Serialize, PartialEq, <|>)] |
333 | #[derive(serde::Serialize, PartialEq, <|>)] | 275 | struct Test {} |
334 | struct Test {} | 276 | "#, |
335 | ", | 277 | expect![[r#" |
336 | ), | 278 | at Clone |
337 | @r###" | 279 | at Copy, Clone |
338 | [ | 280 | at Debug |
339 | CompletionItem { | 281 | at Default |
340 | label: "Clone", | 282 | at Eq |
341 | source_range: 38..38, | 283 | at Hash |
342 | delete: 38..38, | 284 | at Ord, PartialOrd, Eq |
343 | insert: "Clone", | 285 | at PartialOrd |
344 | kind: Attribute, | 286 | "#]], |
345 | }, | 287 | ) |
346 | CompletionItem { | ||
347 | label: "Copy, Clone", | ||
348 | source_range: 38..38, | ||
349 | delete: 38..38, | ||
350 | insert: "Copy, Clone", | ||
351 | kind: Attribute, | ||
352 | }, | ||
353 | CompletionItem { | ||
354 | label: "Debug", | ||
355 | source_range: 38..38, | ||
356 | delete: 38..38, | ||
357 | insert: "Debug", | ||
358 | kind: Attribute, | ||
359 | }, | ||
360 | CompletionItem { | ||
361 | label: "Default", | ||
362 | source_range: 38..38, | ||
363 | delete: 38..38, | ||
364 | insert: "Default", | ||
365 | kind: Attribute, | ||
366 | }, | ||
367 | CompletionItem { | ||
368 | label: "Eq", | ||
369 | source_range: 38..38, | ||
370 | delete: 38..38, | ||
371 | insert: "Eq", | ||
372 | kind: Attribute, | ||
373 | }, | ||
374 | CompletionItem { | ||
375 | label: "Hash", | ||
376 | source_range: 38..38, | ||
377 | delete: 38..38, | ||
378 | insert: "Hash", | ||
379 | kind: Attribute, | ||
380 | }, | ||
381 | CompletionItem { | ||
382 | label: "Ord, PartialOrd, Eq", | ||
383 | source_range: 38..38, | ||
384 | delete: 38..38, | ||
385 | insert: "Ord, PartialOrd, Eq", | ||
386 | kind: Attribute, | ||
387 | }, | ||
388 | CompletionItem { | ||
389 | label: "PartialOrd", | ||
390 | source_range: 38..38, | ||
391 | delete: 38..38, | ||
392 | insert: "PartialOrd", | ||
393 | kind: Attribute, | ||
394 | }, | ||
395 | ] | ||
396 | "### | ||
397 | ); | ||
398 | } | 288 | } |
399 | 289 | ||
400 | #[test] | 290 | #[test] |
401 | fn test_attribute_completion() { | 291 | fn test_attribute_completion() { |
402 | assert_debug_snapshot!( | 292 | check( |
403 | do_attr_completion( | 293 | r#"#[<|>]"#, |
404 | r" | 294 | expect![[r#" |
405 | #[<|>] | 295 | at allow(…) |
406 | ", | 296 | at cfg(…) |
407 | ), | 297 | at cfg_attr(…) |
408 | @r###" | 298 | at deny(…) |
409 | [ | 299 | at deprecated = "…" |
410 | CompletionItem { | 300 | at derive(…) |
411 | label: "allow(…)", | 301 | at doc = "…" |
412 | source_range: 2..2, | 302 | at forbid(…) |
413 | delete: 2..2, | 303 | at ignore(…) |
414 | insert: "allow(${0:lint})", | 304 | at inline(…) |
415 | kind: Attribute, | 305 | at link |
416 | lookup: "allow", | 306 | at link_name = "…" |
417 | }, | 307 | at macro_export |
418 | CompletionItem { | 308 | at macro_use |
419 | label: "cfg(…)", | 309 | at must_use = "…" |
420 | source_range: 2..2, | 310 | at no_mangle |
421 | delete: 2..2, | 311 | at non_exhaustive |
422 | insert: "cfg(${0:predicate})", | 312 | at path = "…" |
423 | kind: Attribute, | 313 | at proc_macro |
424 | lookup: "cfg", | 314 | at proc_macro_attribute |
425 | }, | 315 | at proc_macro_derive(…) |
426 | CompletionItem { | 316 | at repr(…) |
427 | label: "cfg_attr(…)", | 317 | at should_panic(…) |
428 | source_range: 2..2, | 318 | at target_feature = "…" |
429 | delete: 2..2, | 319 | at test |
430 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 320 | at used |
431 | kind: Attribute, | 321 | at warn(…) |
432 | lookup: "cfg_attr", | 322 | "#]], |
433 | }, | 323 | ) |
434 | CompletionItem { | ||
435 | label: "deny(…)", | ||
436 | source_range: 2..2, | ||
437 | delete: 2..2, | ||
438 | insert: "deny(${0:lint})", | ||
439 | kind: Attribute, | ||
440 | lookup: "deny", | ||
441 | }, | ||
442 | CompletionItem { | ||
443 | label: "deprecated = \"…\"", | ||
444 | source_range: 2..2, | ||
445 | delete: 2..2, | ||
446 | insert: "deprecated = \"${0:reason}\"", | ||
447 | kind: Attribute, | ||
448 | lookup: "deprecated", | ||
449 | }, | ||
450 | CompletionItem { | ||
451 | label: "derive(…)", | ||
452 | source_range: 2..2, | ||
453 | delete: 2..2, | ||
454 | insert: "derive(${0:Debug})", | ||
455 | kind: Attribute, | ||
456 | lookup: "derive", | ||
457 | }, | ||
458 | CompletionItem { | ||
459 | label: "doc = \"…\"", | ||
460 | source_range: 2..2, | ||
461 | delete: 2..2, | ||
462 | insert: "doc = \"${0:docs}\"", | ||
463 | kind: Attribute, | ||
464 | lookup: "doc", | ||
465 | }, | ||
466 | CompletionItem { | ||
467 | label: "forbid(…)", | ||
468 | source_range: 2..2, | ||
469 | delete: 2..2, | ||
470 | insert: "forbid(${0:lint})", | ||
471 | kind: Attribute, | ||
472 | lookup: "forbid", | ||
473 | }, | ||
474 | CompletionItem { | ||
475 | label: "ignore(…)", | ||
476 | source_range: 2..2, | ||
477 | delete: 2..2, | ||
478 | insert: "ignore(${0:lint})", | ||
479 | kind: Attribute, | ||
480 | lookup: "ignore", | ||
481 | }, | ||
482 | CompletionItem { | ||
483 | label: "inline(…)", | ||
484 | source_range: 2..2, | ||
485 | delete: 2..2, | ||
486 | insert: "inline(${0:lint})", | ||
487 | kind: Attribute, | ||
488 | lookup: "inline", | ||
489 | }, | ||
490 | CompletionItem { | ||
491 | label: "link", | ||
492 | source_range: 2..2, | ||
493 | delete: 2..2, | ||
494 | insert: "link", | ||
495 | kind: Attribute, | ||
496 | }, | ||
497 | CompletionItem { | ||
498 | label: "link_name = \"…\"", | ||
499 | source_range: 2..2, | ||
500 | delete: 2..2, | ||
501 | insert: "link_name = \"${0:symbol_name}\"", | ||
502 | kind: Attribute, | ||
503 | lookup: "link_name", | ||
504 | }, | ||
505 | CompletionItem { | ||
506 | label: "macro_export", | ||
507 | source_range: 2..2, | ||
508 | delete: 2..2, | ||
509 | insert: "macro_export", | ||
510 | kind: Attribute, | ||
511 | }, | ||
512 | CompletionItem { | ||
513 | label: "macro_use", | ||
514 | source_range: 2..2, | ||
515 | delete: 2..2, | ||
516 | insert: "macro_use", | ||
517 | kind: Attribute, | ||
518 | }, | ||
519 | CompletionItem { | ||
520 | label: "must_use = \"…\"", | ||
521 | source_range: 2..2, | ||
522 | delete: 2..2, | ||
523 | insert: "must_use = \"${0:reason}\"", | ||
524 | kind: Attribute, | ||
525 | lookup: "must_use", | ||
526 | }, | ||
527 | CompletionItem { | ||
528 | label: "no_mangle", | ||
529 | source_range: 2..2, | ||
530 | delete: 2..2, | ||
531 | insert: "no_mangle", | ||
532 | kind: Attribute, | ||
533 | }, | ||
534 | CompletionItem { | ||
535 | label: "non_exhaustive", | ||
536 | source_range: 2..2, | ||
537 | delete: 2..2, | ||
538 | insert: "non_exhaustive", | ||
539 | kind: Attribute, | ||
540 | }, | ||
541 | CompletionItem { | ||
542 | label: "path = \"…\"", | ||
543 | source_range: 2..2, | ||
544 | delete: 2..2, | ||
545 | insert: "path =\"${0:path}\"", | ||
546 | kind: Attribute, | ||
547 | lookup: "path", | ||
548 | }, | ||
549 | CompletionItem { | ||
550 | label: "proc_macro", | ||
551 | source_range: 2..2, | ||
552 | delete: 2..2, | ||
553 | insert: "proc_macro", | ||
554 | kind: Attribute, | ||
555 | }, | ||
556 | CompletionItem { | ||
557 | label: "proc_macro_attribute", | ||
558 | source_range: 2..2, | ||
559 | delete: 2..2, | ||
560 | insert: "proc_macro_attribute", | ||
561 | kind: Attribute, | ||
562 | }, | ||
563 | CompletionItem { | ||
564 | label: "proc_macro_derive(…)", | ||
565 | source_range: 2..2, | ||
566 | delete: 2..2, | ||
567 | insert: "proc_macro_derive(${0:Trait})", | ||
568 | kind: Attribute, | ||
569 | lookup: "proc_macro_derive", | ||
570 | }, | ||
571 | CompletionItem { | ||
572 | label: "repr(…)", | ||
573 | source_range: 2..2, | ||
574 | delete: 2..2, | ||
575 | insert: "repr(${0:C})", | ||
576 | kind: Attribute, | ||
577 | lookup: "repr", | ||
578 | }, | ||
579 | CompletionItem { | ||
580 | label: "should_panic(…)", | ||
581 | source_range: 2..2, | ||
582 | delete: 2..2, | ||
583 | insert: "should_panic(expected = \"${0:reason}\")", | ||
584 | kind: Attribute, | ||
585 | lookup: "should_panic", | ||
586 | }, | ||
587 | CompletionItem { | ||
588 | label: "target_feature = \"…\"", | ||
589 | source_range: 2..2, | ||
590 | delete: 2..2, | ||
591 | insert: "target_feature = \"${0:feature}\"", | ||
592 | kind: Attribute, | ||
593 | lookup: "target_feature", | ||
594 | }, | ||
595 | CompletionItem { | ||
596 | label: "test", | ||
597 | source_range: 2..2, | ||
598 | delete: 2..2, | ||
599 | insert: "test", | ||
600 | kind: Attribute, | ||
601 | }, | ||
602 | CompletionItem { | ||
603 | label: "used", | ||
604 | source_range: 2..2, | ||
605 | delete: 2..2, | ||
606 | insert: "used", | ||
607 | kind: Attribute, | ||
608 | }, | ||
609 | CompletionItem { | ||
610 | label: "warn(…)", | ||
611 | source_range: 2..2, | ||
612 | delete: 2..2, | ||
613 | insert: "warn(${0:lint})", | ||
614 | kind: Attribute, | ||
615 | lookup: "warn", | ||
616 | }, | ||
617 | ] | ||
618 | "### | ||
619 | ); | ||
620 | } | 324 | } |
621 | 325 | ||
622 | #[test] | 326 | #[test] |
623 | fn test_attribute_completion_inside_nested_attr() { | 327 | fn test_attribute_completion_inside_nested_attr() { |
624 | assert_debug_snapshot!( | 328 | check(r#"#[allow(<|>)]"#, expect![[]]) |
625 | do_attr_completion( | ||
626 | r" | ||
627 | #[allow(<|>)] | ||
628 | ", | ||
629 | ), | ||
630 | @r###" | ||
631 | [] | ||
632 | "### | ||
633 | ); | ||
634 | } | 329 | } |
635 | 330 | ||
636 | #[test] | 331 | #[test] |
637 | fn test_inner_attribute_completion() { | 332 | fn test_inner_attribute_completion() { |
638 | assert_debug_snapshot!( | 333 | check( |
639 | do_attr_completion( | 334 | r"#![<|>]", |
640 | r" | 335 | expect![[r#" |
641 | #![<|>] | 336 | at allow(…) |
642 | ", | 337 | at cfg(…) |
643 | ), | 338 | at cfg_attr(…) |
644 | @r###" | 339 | at deny(…) |
645 | [ | 340 | at deprecated = "…" |
646 | CompletionItem { | 341 | at derive(…) |
647 | label: "allow(…)", | 342 | at doc = "…" |
648 | source_range: 3..3, | 343 | at feature(…) |
649 | delete: 3..3, | 344 | at forbid(…) |
650 | insert: "allow(${0:lint})", | 345 | at global_allocator |
651 | kind: Attribute, | 346 | at ignore(…) |
652 | lookup: "allow", | 347 | at inline(…) |
653 | }, | 348 | at link |
654 | CompletionItem { | 349 | at link_name = "…" |
655 | label: "cfg(…)", | 350 | at macro_export |
656 | source_range: 3..3, | 351 | at macro_use |
657 | delete: 3..3, | 352 | at must_use = "…" |
658 | insert: "cfg(${0:predicate})", | 353 | at no_mangle |
659 | kind: Attribute, | 354 | at no_std |
660 | lookup: "cfg", | 355 | at non_exhaustive |
661 | }, | 356 | at panic_handler |
662 | CompletionItem { | 357 | at path = "…" |
663 | label: "cfg_attr(…)", | 358 | at proc_macro |
664 | source_range: 3..3, | 359 | at proc_macro_attribute |
665 | delete: 3..3, | 360 | at proc_macro_derive(…) |
666 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 361 | at recursion_limit = … |
667 | kind: Attribute, | 362 | at repr(…) |
668 | lookup: "cfg_attr", | 363 | at should_panic(…) |
669 | }, | 364 | at target_feature = "…" |
670 | CompletionItem { | 365 | at test |
671 | label: "deny(…)", | 366 | at used |
672 | source_range: 3..3, | 367 | at warn(…) |
673 | delete: 3..3, | 368 | at windows_subsystem = "…" |
674 | insert: "deny(${0:lint})", | 369 | "#]], |
675 | kind: Attribute, | ||
676 | lookup: "deny", | ||
677 | }, | ||
678 | CompletionItem { | ||
679 | label: "deprecated = \"…\"", | ||
680 | source_range: 3..3, | ||
681 | delete: 3..3, | ||
682 | insert: "deprecated = \"${0:reason}\"", | ||
683 | kind: Attribute, | ||
684 | lookup: "deprecated", | ||
685 | }, | ||
686 | CompletionItem { | ||
687 | label: "derive(…)", | ||
688 | source_range: 3..3, | ||
689 | delete: 3..3, | ||
690 | insert: "derive(${0:Debug})", | ||
691 | kind: Attribute, | ||
692 | lookup: "derive", | ||
693 | }, | ||
694 | CompletionItem { | ||
695 | label: "doc = \"…\"", | ||
696 | source_range: 3..3, | ||
697 | delete: 3..3, | ||
698 | insert: "doc = \"${0:docs}\"", | ||
699 | kind: Attribute, | ||
700 | lookup: "doc", | ||
701 | }, | ||
702 | CompletionItem { | ||
703 | label: "feature(…)", | ||
704 | source_range: 3..3, | ||
705 | delete: 3..3, | ||
706 | insert: "feature(${0:flag})", | ||
707 | kind: Attribute, | ||
708 | lookup: "feature", | ||
709 | }, | ||
710 | CompletionItem { | ||
711 | label: "forbid(…)", | ||
712 | source_range: 3..3, | ||
713 | delete: 3..3, | ||
714 | insert: "forbid(${0:lint})", | ||
715 | kind: Attribute, | ||
716 | lookup: "forbid", | ||
717 | }, | ||
718 | CompletionItem { | ||
719 | label: "global_allocator", | ||
720 | source_range: 3..3, | ||
721 | delete: 3..3, | ||
722 | insert: "global_allocator", | ||
723 | kind: Attribute, | ||
724 | }, | ||
725 | CompletionItem { | ||
726 | label: "ignore(…)", | ||
727 | source_range: 3..3, | ||
728 | delete: 3..3, | ||
729 | insert: "ignore(${0:lint})", | ||
730 | kind: Attribute, | ||
731 | lookup: "ignore", | ||
732 | }, | ||
733 | CompletionItem { | ||
734 | label: "inline(…)", | ||
735 | source_range: 3..3, | ||
736 | delete: 3..3, | ||
737 | insert: "inline(${0:lint})", | ||
738 | kind: Attribute, | ||
739 | lookup: "inline", | ||
740 | }, | ||
741 | CompletionItem { | ||
742 | label: "link", | ||
743 | source_range: 3..3, | ||
744 | delete: 3..3, | ||
745 | insert: "link", | ||
746 | kind: Attribute, | ||
747 | }, | ||
748 | CompletionItem { | ||
749 | label: "link_name = \"…\"", | ||
750 | source_range: 3..3, | ||
751 | delete: 3..3, | ||
752 | insert: "link_name = \"${0:symbol_name}\"", | ||
753 | kind: Attribute, | ||
754 | lookup: "link_name", | ||
755 | }, | ||
756 | CompletionItem { | ||
757 | label: "macro_export", | ||
758 | source_range: 3..3, | ||
759 | delete: 3..3, | ||
760 | insert: "macro_export", | ||
761 | kind: Attribute, | ||
762 | }, | ||
763 | CompletionItem { | ||
764 | label: "macro_use", | ||
765 | source_range: 3..3, | ||
766 | delete: 3..3, | ||
767 | insert: "macro_use", | ||
768 | kind: Attribute, | ||
769 | }, | ||
770 | CompletionItem { | ||
771 | label: "must_use = \"…\"", | ||
772 | source_range: 3..3, | ||
773 | delete: 3..3, | ||
774 | insert: "must_use = \"${0:reason}\"", | ||
775 | kind: Attribute, | ||
776 | lookup: "must_use", | ||
777 | }, | ||
778 | CompletionItem { | ||
779 | label: "no_mangle", | ||
780 | source_range: 3..3, | ||
781 | delete: 3..3, | ||
782 | insert: "no_mangle", | ||
783 | kind: Attribute, | ||
784 | }, | ||
785 | CompletionItem { | ||
786 | label: "no_std", | ||
787 | source_range: 3..3, | ||
788 | delete: 3..3, | ||
789 | insert: "no_std", | ||
790 | kind: Attribute, | ||
791 | }, | ||
792 | CompletionItem { | ||
793 | label: "non_exhaustive", | ||
794 | source_range: 3..3, | ||
795 | delete: 3..3, | ||
796 | insert: "non_exhaustive", | ||
797 | kind: Attribute, | ||
798 | }, | ||
799 | CompletionItem { | ||
800 | label: "panic_handler", | ||
801 | source_range: 3..3, | ||
802 | delete: 3..3, | ||
803 | insert: "panic_handler", | ||
804 | kind: Attribute, | ||
805 | }, | ||
806 | CompletionItem { | ||
807 | label: "path = \"…\"", | ||
808 | source_range: 3..3, | ||
809 | delete: 3..3, | ||
810 | insert: "path =\"${0:path}\"", | ||
811 | kind: Attribute, | ||
812 | lookup: "path", | ||
813 | }, | ||
814 | CompletionItem { | ||
815 | label: "proc_macro", | ||
816 | source_range: 3..3, | ||
817 | delete: 3..3, | ||
818 | insert: "proc_macro", | ||
819 | kind: Attribute, | ||
820 | }, | ||
821 | CompletionItem { | ||
822 | label: "proc_macro_attribute", | ||
823 | source_range: 3..3, | ||
824 | delete: 3..3, | ||
825 | insert: "proc_macro_attribute", | ||
826 | kind: Attribute, | ||
827 | }, | ||
828 | CompletionItem { | ||
829 | label: "proc_macro_derive(…)", | ||
830 | source_range: 3..3, | ||
831 | delete: 3..3, | ||
832 | insert: "proc_macro_derive(${0:Trait})", | ||
833 | kind: Attribute, | ||
834 | lookup: "proc_macro_derive", | ||
835 | }, | ||
836 | CompletionItem { | ||
837 | label: "recursion_limit = …", | ||
838 | source_range: 3..3, | ||
839 | delete: 3..3, | ||
840 | insert: "recursion_limit = ${0:128}", | ||
841 | kind: Attribute, | ||
842 | lookup: "recursion_limit", | ||
843 | }, | ||
844 | CompletionItem { | ||
845 | label: "repr(…)", | ||
846 | source_range: 3..3, | ||
847 | delete: 3..3, | ||
848 | insert: "repr(${0:C})", | ||
849 | kind: Attribute, | ||
850 | lookup: "repr", | ||
851 | }, | ||
852 | CompletionItem { | ||
853 | label: "should_panic(…)", | ||
854 | source_range: 3..3, | ||
855 | delete: 3..3, | ||
856 | insert: "should_panic(expected = \"${0:reason}\")", | ||
857 | kind: Attribute, | ||
858 | lookup: "should_panic", | ||
859 | }, | ||
860 | CompletionItem { | ||
861 | label: "target_feature = \"…\"", | ||
862 | source_range: 3..3, | ||
863 | delete: 3..3, | ||
864 | insert: "target_feature = \"${0:feature}\"", | ||
865 | kind: Attribute, | ||
866 | lookup: "target_feature", | ||
867 | }, | ||
868 | CompletionItem { | ||
869 | label: "test", | ||
870 | source_range: 3..3, | ||
871 | delete: 3..3, | ||
872 | insert: "test", | ||
873 | kind: Attribute, | ||
874 | }, | ||
875 | CompletionItem { | ||
876 | label: "used", | ||
877 | source_range: 3..3, | ||
878 | delete: 3..3, | ||
879 | insert: "used", | ||
880 | kind: Attribute, | ||
881 | }, | ||
882 | CompletionItem { | ||
883 | label: "warn(…)", | ||
884 | source_range: 3..3, | ||
885 | delete: 3..3, | ||
886 | insert: "warn(${0:lint})", | ||
887 | kind: Attribute, | ||
888 | lookup: "warn", | ||
889 | }, | ||
890 | CompletionItem { | ||
891 | label: "windows_subsystem = \"…\"", | ||
892 | source_range: 3..3, | ||
893 | delete: 3..3, | ||
894 | insert: "windows_subsystem = \"${0:subsystem}\"", | ||
895 | kind: Attribute, | ||
896 | lookup: "windows_subsystem", | ||
897 | }, | ||
898 | ] | ||
899 | "### | ||
900 | ); | 370 | ); |
901 | } | 371 | } |
902 | } | 372 | } |