Skip to content

Commit 3f4a095

Browse files
bors[bot]lnicola
andauthored
Merge #11647
11647: Improve inlay hint padding r=lnicola a=lnicola Co-authored-by: Laurențiu Nicola <[email protected]>
2 parents 49646b7 + 8e3057d commit 3f4a095

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

crates/rust-analyzer/src/to_proto.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,26 @@ pub(crate) fn inlay_hint(line_index: &LineIndex, inlay_hint: InlayHint) -> lsp_e
418418
label: inlay_hint.label.to_string(),
419419
position: match inlay_hint.kind {
420420
InlayKind::ParameterHint => position(line_index, inlay_hint.range.start()),
421-
_ => position(line_index, inlay_hint.range.end()),
421+
InlayKind::TypeHint | InlayKind::ChainingHint => {
422+
position(line_index, inlay_hint.range.end())
423+
}
422424
},
423425
kind: match inlay_hint.kind {
424426
InlayKind::ParameterHint => Some(lsp_ext::InlayHintKind::PARAMETER),
425427
InlayKind::TypeHint => Some(lsp_ext::InlayHintKind::TYPE),
426428
InlayKind::ChainingHint => None,
427429
},
428430
tooltip: None,
429-
padding_left: Some(true),
430-
padding_right: Some(true),
431+
padding_left: Some(match inlay_hint.kind {
432+
InlayKind::TypeHint => true,
433+
InlayKind::ParameterHint => false,
434+
InlayKind::ChainingHint => true,
435+
}),
436+
padding_right: Some(match inlay_hint.kind {
437+
InlayKind::TypeHint => false,
438+
InlayKind::ParameterHint => true,
439+
InlayKind::ChainingHint => false,
440+
}),
431441
}
432442
}
433443

0 commit comments

Comments
 (0)