11658: Add back colons around inlay hints r=Veykril a=lnicola

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2797#issuecomment-1061594139.

I originally thought that other extensions don't include the colons, but the TypeScript one seems to do.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
bors[bot] 2022-03-08 10:31:54 +00:00 committed by GitHub
commit 4924072493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -415,7 +415,11 @@ pub(crate) fn signature_help(
pub(crate) fn inlay_hint(line_index: &LineIndex, inlay_hint: InlayHint) -> lsp_ext::InlayHint {
lsp_ext::InlayHint {
label: inlay_hint.label.to_string(),
label: match inlay_hint.kind {
InlayKind::ParameterHint => format!("{}:", inlay_hint.label),
InlayKind::TypeHint => format!(": {}", inlay_hint.label),
InlayKind::ChainingHint => inlay_hint.label.to_string(),
},
position: match inlay_hint.kind {
InlayKind::ParameterHint => position(line_index, inlay_hint.range.start()),
InlayKind::TypeHint | InlayKind::ChainingHint => {
@ -429,7 +433,7 @@ pub(crate) fn inlay_hint(line_index: &LineIndex, inlay_hint: InlayHint) -> lsp_e
},
tooltip: None,
padding_left: Some(match inlay_hint.kind {
InlayKind::TypeHint => true,
InlayKind::TypeHint => false,
InlayKind::ParameterHint => false,
InlayKind::ChainingHint => true,
}),