@@ -163,18 +163,45 @@ function! s:place_highlights(server, diagnostics_response, bufnr) abort
163163 \ l: line - 1 , l: highlight_start_col - 1 , l: highlight_end_col == -1 ? -1 : l: highlight_end_col )
164164 endfor
165165 else
166- try
167- " TODO: need to check for valid range before calling prop_add
168- " See https://github.com/prabirshrestha/vim-lsp/pull/721
169- silent ! call prop_add (l: start_line , l: start_col , {
170- \ ' end_lnum' : l: end_line ,
171- \ ' end_col' : l: end_col ,
172- \ ' bufnr' : a: bufnr ,
173- \ ' type' : s: get_prop_type_name (l: severity ),
174- \ })
175- catch
176- call lsp#log (' diagnostics' , ' place_highlights' , ' prop_add' , v: exception , v: throwpoint )
177- endtry
166+ if l: start_line == l: end_line
167+ try
168+ " TODO: need to check for valid range before calling prop_add
169+ " See https://github.com/prabirshrestha/vim-lsp/pull/721
170+ silent ! call prop_add (l: start_line , l: start_col , {
171+ \ ' end_col' : l: end_col ,
172+ \ ' bufnr' : a: bufnr ,
173+ \ ' type' : s: get_prop_type_name (l: severity ),
174+ \ })
175+ catch
176+ call lsp#log (' diagnostics' , ' place_highlights' , ' prop_add' , v: exception , v: throwpoint )
177+ endtry
178+ else
179+ for l: line in range (l: start_line , l: end_line )
180+ if l: line == l: start_line
181+ let l: highlight_start_col = l: start_col
182+ else
183+ let l: highlight_start_col = 1
184+ endif
185+
186+ if l: line == l: end_line
187+ let l: highlight_end_col = l: end_col
188+ else
189+ let l: highlight_end_col = strlen (getbufline (a: bufnr , l: line , l: line )[0 ]) + 1
190+ endif
191+
192+ try
193+ " TODO: need to check for valid range before calling prop_add
194+ " See https://github.com/prabirshrestha/vim-lsp/pull/721
195+ silent ! call prop_add (l: line , l: highlight_start_col , {
196+ \ ' end_col' : l: highlight_end_col ,
197+ \ ' bufnr' : a: bufnr ,
198+ \ ' type' : s: get_prop_type_name (l: severity ),
199+ \ })
200+ catch
201+ call lsp#log (' diagnostics' , ' place_highlights' , ' prop_add' , v: exception , v: throwpoint )
202+ endtry
203+ endfor
204+ endif
178205 endif
179206 endfor
180207endfunction
0 commit comments