Place multi-line highlights every lines (#1422)

* Place multi-line highlights every lines

* Update autoload/lsp/internal/diagnostics/highlights.vim

Co-authored-by: mattn <mattn.jp@gmail.com>

Co-authored-by: mattn <mattn.jp@gmail.com>
This commit is contained in:
Ryuichiroh
2023-01-23 08:04:56 +09:00
committed by GitHub
parent 3244bed522
commit e0111e199d

View File

@@ -163,11 +163,11 @@ function! s:place_highlights(server, diagnostics_response, bufnr) abort
\ l:line - 1, l:highlight_start_col - 1, l:highlight_end_col == -1 ? -1 : l:highlight_end_col)
endfor
else
if l:start_line == l:end_line
try
" TODO: need to check for valid range before calling prop_add
" See https://github.com/prabirshrestha/vim-lsp/pull/721
silent! call prop_add(l:start_line, l:start_col, {
\ 'end_lnum': l:end_line,
\ 'end_col': l:end_col,
\ 'bufnr': a:bufnr,
\ 'type': s:get_prop_type_name(l:severity),
@@ -175,6 +175,33 @@ function! s:place_highlights(server, diagnostics_response, bufnr) abort
catch
call lsp#log('diagnostics', 'place_highlights', 'prop_add', v:exception, v:throwpoint)
endtry
else
for l:line in range(l:start_line, l:end_line)
if l:line == l:start_line
let l:highlight_start_col = l:start_col
else
let l:highlight_start_col = 1
endif
if l:line == l:end_line
let l:highlight_end_col = l:end_col
else
let l:highlight_end_col = strlen(getbufline(a:bufnr, l:line, l:line)[0]) + 1
endif
try
" TODO: need to check for valid range before calling prop_add
" See https://github.com/prabirshrestha/vim-lsp/pull/721
silent! call prop_add(l:line, l:highlight_start_col, {
\ 'end_col': l:highlight_end_col,
\ 'bufnr': a:bufnr,
\ 'type': s:get_prop_type_name(l:severity),
\ })
catch
call lsp#log('diagnostics', 'place_highlights', 'prop_add', v:exception, v:throwpoint)
endtry
endfor
endif
endif
endfor
endfunction