Skip to content

Commit 834656f

Browse files
committed
Diagnostic float: Record position before debounce time
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.
1 parent 356254d commit 834656f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

autoload/lsp/internal/diagnostics/float.vim

+10-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,17 @@ function! lsp#internal#diagnostics#float#_enable() abort
2626
\ ),
2727
\ lsp#callbag#filter({_->g:lsp_diagnostics_float_cursor}),
2828
\ lsp#callbag#tap({_->s:hide_float()}),
29+
\ lsp#callbag#map({_->{
30+
\ 'bufnr': bufnr('%'),
31+
\ 'curpos': getcurpos()[0:2],
32+
\ 'changedtick': b:changedtick
33+
\ }}),
2934
\ lsp#callbag#debounceTime(g:lsp_diagnostics_float_delay),
30-
\ lsp#callbag#map({_->{'bufnr': bufnr('%'), 'curpos': getcurpos()[0:2], 'changedtick': b:changedtick }}),
31-
\ lsp#callbag#distinctUntilChanged({a,b -> a['bufnr'] == b['bufnr'] && a['curpos'] == b['curpos'] && a['changedtick'] == b['changedtick']}),
35+
\ lsp#callbag#distinctUntilChanged({a,b ->
36+
\ a['bufnr'] == b['bufnr']
37+
\ && a['curpos'] == b['curpos']
38+
\ && a['changedtick'] == b['changedtick']
39+
\ }),
3240
\ lsp#callbag#filter({_->mode() is# 'n'}),
3341
\ lsp#callbag#filter({_->getbufvar(bufnr('%'), '&buftype') !=# 'terminal' }),
3442
\ lsp#callbag#map({_->lsp#internal#diagnostics#under_cursor#get_diagnostic()}),

0 commit comments

Comments
 (0)