Skip to content

Commit 8bed5fb

Browse files
authored
Give neovim virtual text a high deafult priority (#418)
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.
1 parent 72f89c8 commit 8bed5fb

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

autoload/codeium.vim

+4-1
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,11 @@ function! s:RenderCurrentCompletion() abort
239239
endif
240240

241241
if has('nvim')
242+
" Set priority high so that completions appear above LSP inlay hints
243+
let priority = get(b:, 'codeium_virtual_text_priority',
244+
\ get(g:, 'codeium_virtual_text_priority', 65535))
242245
let _virtcol = virtcol([row, _col+diff])
243-
let data = {'id': idx + 1, 'hl_mode': 'combine', 'virt_text_win_col': _virtcol - 1}
246+
let data = {'id': idx + 1, 'hl_mode': 'combine', 'virt_text_win_col': _virtcol - 1, 'priority': priority }
244247
if part.type ==# 'COMPLETION_PART_TYPE_INLINE_MASK'
245248
let data.virt_text = [[text, s:hlgroup]]
246249
elseif part.type ==# 'COMPLETION_PART_TYPE_BLOCK'

doc/codeium.txt

+24
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,30 @@ g:codeium_arch Manually set the host architecture, accepted values
108108
>
109109
let g:codeium_arch = "x86_64"
110110
<
111+
*g:codeium_virtual_text_priority*
112+
g:codeium_virtual_text_priority
113+
The priority used for Codeium's virtual text completions
114+
in Neovim. This can control how completions appear when
115+
multiple virtual text items are on the same line, such
116+
as when using LSP inlay hints.
117+
118+
The priority can be set on a per-buffer basis by setting
119+
the b:codeium_virtual_text_priority variable. If
120+
neither of these are set, the default priority is 65535,
121+
which will usually place it above any other virtual text.
122+
>
123+
let g:codeium_virtual_text_priority = 1000
124+
<
125+
126+
*b:codeium_virtual_text_priority*
127+
b:codeium_virtual_text_priority
128+
The priority given to Codeium's virtual text completions
129+
for the current buffer in Neovim. If not set,
130+
g:codeium_virtual_text_priority is used.
131+
>
132+
let b:codeium_virtual_text_priority = 1000
133+
<
134+
111135
MAPS *codeium-maps*
112136

113137
*codeium-i_<Tab>*

0 commit comments

Comments
 (0)