Add option to disable float of diagnostic error when insert mode (#1417)

This commit is contained in:
Ryuichiroh
2023-01-15 18:57:42 +09:00
committed by GitHub
parent 500987604d
commit 3244bed522
3 changed files with 23 additions and 1 deletions

View File

@@ -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),

View File

@@ -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`

View File

@@ -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)