diff --git a/autoload/lsp/internal/diagnostics/float.vim b/autoload/lsp/internal/diagnostics/float.vim index f835a7b1..f7f40a15 100644 --- a/autoload/lsp/internal/diagnostics/float.vim +++ b/autoload/lsp/internal/diagnostics/float.vim @@ -16,7 +16,14 @@ function! lsp#internal#diagnostics#float#_enable() abort let s:enabled = 1 let s:Dispose = lsp#callbag#pipe( - \ lsp#callbag#fromEvent('CursorMoved'), + \ lsp#callbag#merge( + \ lsp#callbag#fromEvent(['CursorMoved', 'CursorHold']), + \ lsp#callbag#pipe( + \ lsp#callbag#fromEvent(['InsertEnter']), + \ lsp#callbag#filter({_->!g:lsp_diagnostics_float_insert_mode_enabled}), + \ lsp#callbag#tap({_->s:hide_float()}), + \ ) + \ ), \ lsp#callbag#filter({_->g:lsp_diagnostics_float_cursor}), \ lsp#callbag#tap({_->s:hide_float()}), \ lsp#callbag#debounceTime(g:lsp_diagnostics_float_delay), diff --git a/doc/vim-lsp.txt b/doc/vim-lsp.txt index 9304d406..14c02304 100644 --- a/doc/vim-lsp.txt +++ b/doc/vim-lsp.txt @@ -30,6 +30,8 @@ CONTENTS *vim-lsp-contents* g:lsp_diagnostics_echo_delay |g:lsp_diagnostics_echo_delay| g:lsp_diagnostics_float_cursor |g:lsp_diagnostics_float_cursor| g:lsp_diagnostics_float_delay |g:lsp_diagnostics_float_delay| + g:lsp_diagnostics_float_insert_mode_enabled + |g:lsp_diagnostics_float_insert_mode_enabled| g:lsp_diagnostics_highlights_enabled |g:lsp_diagnostics_highlights_enabled| g:lsp_diagnostics_highlights_insert_mode_enabled @@ -531,6 +533,18 @@ g:lsp_diagnostics_float_delay *g:lsp_diagnostics_float_delay* let g:lsp_diagnostics_float_delay = 200 let g:lsp_diagnostics_float_delay = 1000 +g:lsp_diagnostics_float_insert_mode_enabled + *g:lsp_diagnostics_float_insert_mode_enabled* + Type: |Boolean| + Default: `1` + + Indicates whether to enable float of diagnostic error for the current line + to status when in |insertmode|. Requires |g:lsp_diagnostics_enabled| and + |g:lsp_diagnostics_float_cursor| set to 1. + + Example: > + let g:lsp_diagnostics_float_insert_mode_enabled = 0 + g:lsp_format_sync_timeout *g:lsp_format_sync_timeout* Type: |Number| Default: `-1` diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 83ad2c41..603eb5a2 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -21,6 +21,7 @@ let g:lsp_diagnostics_echo_cursor = get(g:, 'lsp_diagnostics_echo_cursor', 0) let g:lsp_diagnostics_echo_delay = get(g:, 'lsp_diagnostics_echo_delay', 500) let g:lsp_diagnostics_float_cursor = get(g:, 'lsp_diagnostics_float_cursor', 0) let g:lsp_diagnostics_float_delay = get(g:, 'lsp_diagnostics_float_delay', 500) +let g:lsp_diagnostics_float_insert_mode_enabled = get(g:, 'lsp_diagnostics_float_insert_mode_enabled', 1) let g:lsp_diagnostics_highlights_enabled = get(g:, 'lsp_diagnostics_highlights_enabled', lsp#utils#_has_highlights()) let g:lsp_diagnostics_highlights_insert_mode_enabled = get(g:, 'lsp_diagnostics_highlights_insert_mode_enabled', 1) let g:lsp_diagnostics_highlights_delay = get(g:, 'lsp_diagnostics_highlights_delay', 500)