1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 18:25:42 +08:00

feat(lsp): make SPC e c support to clear diagnostics

If lsp is enabled for current buffer. SPC e c should be able to
clear diagnostics.
This commit is contained in:
Shidong Wang 2021-10-06 22:56:47 +08:00
parent aa3deb1f25
commit 35bdf0da3e
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
2 changed files with 11 additions and 1 deletions

View File

@ -391,5 +391,12 @@ endif
" TODO clear errors
function! s:clear_errors() abort
sign unplace *
if SpaceVim#lsp#buf_server_ready()
call SpaceVim#lsp#diagnostic_clear()
if get(getloclist(0, {'title': 0}), 'title', '') ==# 'Language Server'
call setloclist(0, [], 'r')
endif
else
sign unplace *
endif
endfunction

View File

@ -71,6 +71,9 @@ if (has('nvim-0.5.0') && s:NVIM_VERSION.is_release_version()) || has('nvim-0.6.0
function! SpaceVim#lsp#diagnostic_goto_prev() abort
lua vim.lsp.diagnostic.goto_prev()
endfunction
function! SpaceVim#lsp#diagnostic_clear() abort
lua vim.lsp.diagnostic.clear(0)
endfunction
elseif SpaceVim#layers#isLoaded('autocomplete') && get(g:, 'spacevim_autocomplete_method') ==# 'coc'
" use coc.nvim
let s:coc_language_servers = {}