Skip to content

Commit

Permalink
Give neovim virtual text a high deafult priority (#418)
Browse files Browse the repository at this point in the history
This allows the suggestions to appear on top of coc.nvim inlay hints,
whereas with the default priority they appear below the inlay hint which
makes the suggestions difficult to read.

The default value is 65535, and the priority can be customized by setting the
g:codeium_virtual_text_priority and b:codeium_virtual_text_priority
variables.
  • Loading branch information
dimfeld authored Aug 22, 2024
1 parent 72f89c8 commit 8bed5fb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion autoload/codeium.vim
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ function! s:RenderCurrentCompletion() abort
endif

if has('nvim')
" Set priority high so that completions appear above LSP inlay hints
let priority = get(b:, 'codeium_virtual_text_priority',
\ get(g:, 'codeium_virtual_text_priority', 65535))
let _virtcol = virtcol([row, _col+diff])
let data = {'id': idx + 1, 'hl_mode': 'combine', 'virt_text_win_col': _virtcol - 1}
let data = {'id': idx + 1, 'hl_mode': 'combine', 'virt_text_win_col': _virtcol - 1, 'priority': priority }
if part.type ==# 'COMPLETION_PART_TYPE_INLINE_MASK'
let data.virt_text = [[text, s:hlgroup]]
elseif part.type ==# 'COMPLETION_PART_TYPE_BLOCK'
Expand Down
24 changes: 24 additions & 0 deletions doc/codeium.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,30 @@ g:codeium_arch Manually set the host architecture, accepted values
>
let g:codeium_arch = "x86_64"
<
*g:codeium_virtual_text_priority*
g:codeium_virtual_text_priority
The priority used for Codeium's virtual text completions
in Neovim. This can control how completions appear when
multiple virtual text items are on the same line, such
as when using LSP inlay hints.

The priority can be set on a per-buffer basis by setting
the b:codeium_virtual_text_priority variable. If
neither of these are set, the default priority is 65535,
which will usually place it above any other virtual text.
>
let g:codeium_virtual_text_priority = 1000
<

*b:codeium_virtual_text_priority*
b:codeium_virtual_text_priority
The priority given to Codeium's virtual text completions
for the current buffer in Neovim. If not set,
g:codeium_virtual_text_priority is used.
>
let b:codeium_virtual_text_priority = 1000
<

MAPS *codeium-maps*

*codeium-i_<Tab>*
Expand Down

0 comments on commit 8bed5fb

Please sign in to comment.