Skip to content

Commit

Permalink
Diagnostic float: Record position before debounce time
Browse files Browse the repository at this point in the history
It seems that we should be recording the current buffer, cursor position
and change tick before we wait to see if the float should be shown or
not.  Otherwise, if any of the above change during the
`g:lsp_diagnostics_float_delay` our recording would be incorrect.
  • Loading branch information
ilya-bobyr committed Jul 20, 2024
1 parent a8f244a commit 9946229
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions autoload/lsp/internal/diagnostics/float.vim
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,17 @@ function! lsp#internal#diagnostics#float#_enable() abort
\ ),
\ lsp#callbag#filter({_->g:lsp_diagnostics_float_cursor}),
\ lsp#callbag#tap({_->s:hide_float()}),
\ lsp#callbag#map({_->{
\ 'bufnr': bufnr('%'),
\ 'curpos': getcurpos()[0:2],
\ 'changedtick': b:changedtick
\ }}),
\ 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']}),
\ lsp#callbag#distinctUntilChanged({a,b ->
\ a['bufnr'] == b['bufnr']
\ && a['curpos'] == b['curpos']
\ && a['changedtick'] == b['changedtick']
\ }),
\ lsp#callbag#filter({_->mode() is# 'n'}),
\ lsp#callbag#filter({_->getbufvar(bufnr('%'), '&buftype') !=# 'terminal' }),
\ lsp#callbag#map({_->lsp#internal#diagnostics#under_cursor#get_diagnostic()}),
Expand Down

0 comments on commit 9946229

Please sign in to comment.