Skip to content

Commit

Permalink
fix(inlayHint): correct gravity for virt_text (#5081)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhwang91 authored Jul 11, 2024
1 parent cfa1115 commit 6e1efbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions autoload/coc/vtext.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function! coc#vtext#add(bufnr, src_id, line, blocks, opts) abort
let opts['virt_text'] = a:blocks
if s:n10 && column != 0
let opts['virt_text_pos'] = 'inline'
let opts['right_gravity'] = get(a:opts, 'right_gravity', v:true)
elseif align ==# 'right'
let opts['virt_text_pos'] = 'right_align'
else
Expand Down
5 changes: 4 additions & 1 deletion src/handler/inlayHint/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ export default class InlayHintBuffer implements SyncItem {
if (this.config.position == InlayHintPosition.Eol) {
col = 0
}
buffer.setVirtualText(srcId, position.line, chunks, { col, hl_mode: 'replace' })
// TODO right_gravity field is absent in VirtualTextOption
let opts: any = { col, hl_mode: 'replace' }
if (nvim.isVim && item.kind == InlayHintKind.Parameter) { opts.right_gravity = false }
buffer.setVirtualText(srcId, position.line, chunks, opts)
}
nvim.resumeNotification(true, true)
this._onDidRefresh.fire()
Expand Down

0 comments on commit 6e1efbf

Please sign in to comment.