Skip to content

Commit

Permalink
Process the padding value in inlay hints
Browse files Browse the repository at this point in the history
  • Loading branch information
yegappan committed Feb 6, 2024
1 parent 314a41a commit 1d76279
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion autoload/lsp/inlayhints.vim
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ export def InlayHintsReply(lspserver: dict<any>, bnr: number, inlayHints: any)
label = hint.label
endif

# add a space before or after the label
var padLeft: bool = hint->get('paddingLeft', false)
var padRight: bool = hint->get('paddingRight', false)
if padLeft
label = $' {label}'
endif
if padRight
label = $'{label} '
endif

var kind = hint->has_key('kind') ? hint.kind->string() : '1'
try
lspserver.decodePosition(bnr, hint.position)
Expand All @@ -57,7 +67,6 @@ export def InlayHintsReply(lspserver: dict<any>, bnr: number, inlayHints: any)
prop_add(hint.position.line + 1, byteIdx + 1,
{type: 'LspInlayHintsType', text: label, bufnr: bnr})
elseif kind == "'parameter'" || kind == '2'
label = label .. " "
prop_add(hint.position.line + 1, byteIdx + 1,
{type: 'LspInlayHintsParam', text: label, bufnr: bnr})
endif
Expand Down

0 comments on commit 1d76279

Please sign in to comment.