mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
Register CursorMoved event only when required (#699)
This commit is contained in:
@@ -189,9 +189,10 @@ function! s:register_events() abort
|
|||||||
if exists('##TextChangedP')
|
if exists('##TextChangedP')
|
||||||
autocmd TextChangedP * call s:on_text_document_did_change()
|
autocmd TextChangedP * call s:on_text_document_did_change()
|
||||||
endif
|
endif
|
||||||
autocmd CursorMoved * call s:on_cursor_moved()
|
if g:lsp_diagnostics_echo_cursor || g:lsp_highlight_references_enabled
|
||||||
|
autocmd CursorMoved * call s:on_cursor_moved()
|
||||||
|
endif
|
||||||
autocmd BufWinEnter,BufWinLeave,InsertEnter * call lsp#ui#vim#references#clean_references()
|
autocmd BufWinEnter,BufWinLeave,InsertEnter * call lsp#ui#vim#references#clean_references()
|
||||||
autocmd CursorMoved * if g:lsp_highlight_references_enabled | call lsp#ui#vim#references#highlight(v:false) | endif
|
|
||||||
augroup END
|
augroup END
|
||||||
call s:on_text_document_did_open()
|
call s:on_text_document_did_open()
|
||||||
endfunction
|
endfunction
|
||||||
@@ -239,7 +240,14 @@ endfunction
|
|||||||
function! s:on_cursor_moved() abort
|
function! s:on_cursor_moved() abort
|
||||||
let l:buf = bufnr('%')
|
let l:buf = bufnr('%')
|
||||||
if getbufvar(l:buf, '&buftype') ==# 'terminal' | return | endif
|
if getbufvar(l:buf, '&buftype') ==# 'terminal' | return | endif
|
||||||
call lsp#ui#vim#diagnostics#echo#cursor_moved()
|
|
||||||
|
if g:lsp_diagnostics_echo_cursor
|
||||||
|
call lsp#ui#vim#diagnostics#echo#cursor_moved()
|
||||||
|
endif
|
||||||
|
|
||||||
|
if g:lsp_highlight_references_enabled
|
||||||
|
call lsp#ui#vim#references#highlight(v:false)
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:call_did_save(buf, server_name, result, cb) abort
|
function! s:call_did_save(buf, server_name, result, cb) abort
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
function! lsp#ui#vim#diagnostics#echo#cursor_moved() abort
|
function! lsp#ui#vim#diagnostics#echo#cursor_moved() abort
|
||||||
if !g:lsp_diagnostics_echo_cursor
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
if mode() isnot# 'n'
|
if mode() isnot# 'n'
|
||||||
" dont' show echo only in normal mode
|
" dont' show echo only in normal mode
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user