1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 04:50:04 +08:00

fix(checkers): clear lsp diagnostics for normal buffer

Problem: SPC e l always list lsp diagnostics.
Solution: clear diagnostics if buf_server_ready return false.
This commit is contained in:
Shidong Wang 2021-10-06 16:20:52 +08:00
parent 309728bcf2
commit 6767f4da4e
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848

View File

@ -172,6 +172,11 @@ function! s:toggle_show_error(...) abort
if SpaceVim#lsp#buf_server_ready()
call SpaceVim#lsp#diagnostic_set_loclist()
else
" if buf_server_ready return false, the language server loclist
" should be cleared.
if get(getloclist(0, {'title': 0}), 'title', '') ==# 'Language Server'
call setloclist(0, [], 'r')
endif
let llist = getloclist(0, {'size' : 1, 'winid' : 1})
let qlist = getqflist({'size' : 1, 'winid' : 1})
if llist.size == 0 && qlist.size == 0