diff options
-rw-r--r-- | crates/ra_ide_api/src/inlay_hints.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/inlay_hints.rs b/crates/ra_ide_api/src/inlay_hints.rs index 6cd492b2a..24a7ca5e7 100644 --- a/crates/ra_ide_api/src/inlay_hints.rs +++ b/crates/ra_ide_api/src/inlay_hints.rs | |||
@@ -514,4 +514,41 @@ fn main() { | |||
514 | "### | 514 | "### |
515 | ); | 515 | ); |
516 | } | 516 | } |
517 | |||
518 | #[test] | ||
519 | fn hint_truncation() { | ||
520 | let (analysis, file_id) = single_file( | ||
521 | r#" | ||
522 | struct Smol<T>(T); | ||
523 | |||
524 | struct VeryLongOuterName<T>(T); | ||
525 | |||
526 | fn main() { | ||
527 | let a = Smol(0u32); | ||
528 | let b = VeryLongOuterName(0usize); | ||
529 | let c = Smol(Smol(0u32)) | ||
530 | }"#, | ||
531 | ); | ||
532 | |||
533 | assert_debug_snapshot!(analysis.inlay_hints(file_id, Some(8)).unwrap(), @r###" | ||
534 | [ | ||
535 | InlayHint { | ||
536 | range: [74; 75), | ||
537 | kind: TypeHint, | ||
538 | label: "Smol<u32>", | ||
539 | }, | ||
540 | InlayHint { | ||
541 | range: [98; 99), | ||
542 | kind: TypeHint, | ||
543 | label: "VeryLongOuterName<…>", | ||
544 | }, | ||
545 | InlayHint { | ||
546 | range: [137; 138), | ||
547 | kind: TypeHint, | ||
548 | label: "Smol<Smol<…>>", | ||
549 | }, | ||
550 | ] | ||
551 | "### | ||
552 | ); | ||
553 | } | ||
517 | } | 554 | } |