Skip to content

Commit

Permalink
Merge #11658
Browse files Browse the repository at this point in the history
11658: Add back colons around inlay hints r=Veykril a=lnicola

Fixes #2797 (comment).

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>
  • Loading branch information
bors[bot] and lnicola authored Mar 8, 2022
2 parents 0f5df8e + 4a6ee45 commit 4924072
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/rust-analyzer/src/to_proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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,
}),
Expand Down

0 comments on commit 4924072

Please sign in to comment.