Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make float auto close configurable #1551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions autoload/lsp/internal/diagnostics/float.vim
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ function! lsp#internal#diagnostics#float#_enable() abort

let s:Dispose = lsp#callbag#pipe(
\ lsp#callbag#merge(
\ lsp#callbag#fromEvent(['CursorMoved', 'CursorHold']),
\ lsp#callbag#fromEvent(['CursorMoved', ]),
\ lsp#callbag#pipe(
\ lsp#callbag#fromEvent(['CursorHold', ]),
\ lsp#callbag#filter({_->g:lsp_diagnostics_float_close_on_hold}),
\ lsp#callbag#tap({_->s:hide_float()}),
\ ),
\ 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),
\ lsp#callbag#map({_->{'bufnr': bufnr('%'), 'curpos': getcurpos()[0:2], 'changedtick': b:changedtick }}),
\ lsp#callbag#distinctUntilChanged({a,b -> a['bufnr'] == b['bufnr'] && a['curpos'] == b['curpos'] && a['changedtick'] == b['changedtick']}),
Expand Down
14 changes: 14 additions & 0 deletions doc/vim-lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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_close_on_hold
|g:lsp_diagnostics_float_close_on_hold|
g:lsp_diagnostics_float_insert_mode_enabled
|g:lsp_diagnostics_float_insert_mode_enabled|
g:lsp_diagnostics_highlights_enabled
Expand Down Expand Up @@ -535,6 +537,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_close_on_hold
*g:lsp_diagnostics_float_close_on_hold*
Type: |Boolean|
Default: `1`

Indicates whether to close float of diagnostic error when <CursorHold> is
triggered. Setting this to 0 will allow float to stay open until cursor
is moved or mode is changed.

Example: >
let g:lsp_diagnostics_float_close_on_hold = 0

g:lsp_diagnostics_float_insert_mode_enabled
*g:lsp_diagnostics_float_insert_mode_enabled*
Type: |Boolean|
Expand Down
1 change: 1 addition & 0 deletions plugin/lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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_close_on_hold = get(g:, 'lsp_diagnostics_float_close_on_hold', 1)
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)
Expand Down
Loading