Fix flicker on document highlighting with vim 9.0.0993 (#1397)

Since v9.0.0993 vim performs a full redraw when removing text property
types, which causes flickering because vim-lsp currently removes and
re-adds the property type every time the highlight is updated. To avoid
that, we can just check if the property type already exists on the
given buffer, and only add it if it doesn't exist yet.
This commit is contained in:
Björn Steinbrink
2023-01-07 01:12:17 +01:00
committed by GitHub
parent c4bae1f79b
commit 500987604d

View File

@@ -190,9 +190,10 @@ function! s:init_reference_highlight(buf) abort
\ 'combine': v:true,
\ 'priority': lsp#internal#textprop#priority('document_highlight')
\ }
call prop_type_delete('vim-lsp-reference-highlight', l:props)
if prop_type_get('vim-lsp-reference-highlight', { 'bufnr': a:buf }) == {}
call prop_type_add('vim-lsp-reference-highlight', l:props)
endif
endif
endfunction
" Cyclically move between references by `offset` occurrences.