diff --git a/autoload/lsp.vim b/autoload/lsp.vim index c305de769..2ef8755a3 100644 --- a/autoload/lsp.vim +++ b/autoload/lsp.vim @@ -29,6 +29,7 @@ augroup _lsp_silent_ autocmd User lsp_float_opened silent autocmd User lsp_float_closed silent autocmd User lsp_buffer_enabled silent + autocmd User lsp_diagnostics_updated silent augroup END function! lsp#log_verbose(...) abort diff --git a/autoload/lsp/ui/vim/diagnostics.vim b/autoload/lsp/ui/vim/diagnostics.vim index cc888ae05..38c204011 100644 --- a/autoload/lsp/ui/vim/diagnostics.vim +++ b/autoload/lsp/ui/vim/diagnostics.vim @@ -18,6 +18,8 @@ function! lsp#ui#vim#diagnostics#handle_text_document_publish_diagnostics(server call lsp#ui#vim#highlights#set(a:server_name, a:data) call lsp#ui#vim#diagnostics#textprop#set(a:server_name, a:data) call lsp#ui#vim#signs#set(a:server_name, a:data) + + doautocmd User lsp_diagnostics_updated endfunction function! lsp#ui#vim#diagnostics#force_refresh(bufnr) abort diff --git a/doc/vim-lsp.txt b/doc/vim-lsp.txt index ef2e7b66b..cfac92828 100644 --- a/doc/vim-lsp.txt +++ b/doc/vim-lsp.txt @@ -99,6 +99,7 @@ CONTENTS *vim-lsp-contents* lsp_server_init |lsp_server_init| lsp_server_exit |lsp_server_exit| lsp_buffer_enabled |lsp_buffer_enabled| + lsp_diagnostics_updated |lsp_diagnostics_updated| Mappings |vim-lsp-mappings| (lsp-preview-close) |(lsp-preview-close)| (lsp-preview-focus) |(lsp-preview-focus)| @@ -1235,6 +1236,20 @@ This autocommand is run after vim-lsp is enabled for the buffer. This event is triggered imediately when the buffer is currently active. If the buffer is not current active, the event will be triggered when the buffer will be active. +lsp_diagnostics_updated *lsp_diagnostics_updated* + +This autocommand us run after every time after new diagnostics received and +processed by vim-lsp. +> + function! DoSomething + echo lsp#get_buffer_diagnostics_counts() + endfunction + + augroup OnLSP + autocmd! + autocmd User lsp_diagnostics_updated call DoSomething() + augroup END +< ============================================================================== Mappings *vim-lsp-mappings*