Skip to content

Commit

Permalink
lsp_diagnostics_updated autocommand (#783)
Browse files Browse the repository at this point in the history
* feat: lsp_diagnostics_updated autocommand

* docs: remove lightline.vim

* docs: generalize not only for status line
  • Loading branch information
mitinarseny authored Apr 11, 2020
1 parent 174e4bf commit 5dd94c6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions autoload/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions autoload/lsp/ui/vim/diagnostics.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions doc/vim-lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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|
<plug>(lsp-preview-close) |<plug>(lsp-preview-close)|
<plug>(lsp-preview-focus) |<plug>(lsp-preview-focus)|
Expand Down Expand Up @@ -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*
Expand Down

0 comments on commit 5dd94c6

Please # to comment.