@@ -40,6 +40,9 @@ if !hlexists('LspHintVirtualText')
40
40
endif
41
41
endif
42
42
43
+ " imports
44
+ let s: Buffer = vital#lsp#import (' VS.Vim.Buffer' )
45
+
43
46
function ! lsp#internal#diagnostics#virtual_text#_enable () abort
44
47
" don't even bother registering if the feature is disabled
45
48
if ! lsp#utils#_has_nvim_virtual_text () && ! lsp#utils#_has_vim_virtual_text () | return | endif
@@ -156,13 +159,14 @@ function! s:set_virtual_text(params) abort
156
159
endfunction
157
160
158
161
function ! s: place_virtual_text (server, diagnostics_response, bufnr ) abort
162
+ let l: linecount = s: Buffer .get_line_count (a: bufnr )
159
163
for l: item in lsp#utils#iteratable (a: diagnostics_response [' params' ][' diagnostics' ])
160
164
let l: line = lsp#utils#position#lsp_line_to_vim (a: bufnr , l: item [' range' ][' start' ])
161
165
let l: name = get (s: severity_sign_names_mapping , get (l: item , ' severity' , 3 ), ' LspError' )
162
166
let l: text = g: lsp_diagnostics_virtual_text_prefix . l: item [' message' ]
163
167
164
168
" Some language servers report an unexpected EOF one line past the end
165
- if l: line == getbufinfo ( a: bufnr )[ 0 ]. linecount + 1
169
+ if l: line == l: linecount + 1
166
170
let l: line = l: line - 1
167
171
endif
168
172
@@ -174,7 +178,7 @@ function! s:place_virtual_text(server, diagnostics_response, bufnr) abort
174
178
else
175
179
" it's an error to add virtual text on lines that don't exist
176
180
" anymore due to async processing, just skip such diagnostics
177
- if l: line <= getbufinfo ( a: bufnr )[ 0 ]. linecount
181
+ if l: line <= l: linecount
178
182
let l: type = ' vim_lsp_' . l: name . ' _virtual_text'
179
183
call prop_remove ({' all' : v: true , ' type' : l: type , ' bufnr' : a: bufnr }, l: line )
180
184
call prop_add (
0 commit comments