Skip to content

make float auto close configurable#1551

Open
EdwarDu wants to merge 1 commit into
prabirshrestha:masterfrom
EdwarDu:no_cursor_hold_for_float
Open

make float auto close configurable#1551
EdwarDu wants to merge 1 commit into
prabirshrestha:masterfrom
EdwarDu:no_cursor_hold_for_float

Conversation

@EdwarDu

@EdwarDu EdwarDu commented Apr 24, 2024

Copy link
Copy Markdown

Some diag message may be long that close on CursorHold (updatetime) is not desirable.

@stale

stale Bot commented Apr 26, 2025

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

1 similar comment
@stale

stale Bot commented Jul 19, 2025

Copy link
Copy Markdown

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@mattn

mattn commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the PR. The idea of making CursorHold float close behavior configurable is useful, but I think there is a bug in the current implementation.

The tap({_->s:hide_float()}) was removed from the main pipeline, which means the float is no longer hidden immediately on CursorMoved either. This causes the old diagnostic float to remain visible for up to g:lsp_diagnostics_float_delay ms (default 500ms) after the cursor moves, even though it's showing stale content at the wrong position.

The fix should only affect CursorHold behavior while keeping the immediate hide on CursorMoved. Something like:

let s:Dispose = lsp#callbag#pipe(
    \ lsp#callbag#merge(
    \   lsp#callbag#pipe(
    \       lsp#callbag#fromEvent(['CursorMoved']),
    \       lsp#callbag#tap({_->s:hide_float()}),
    \   ),
    \   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#debounceTime(g:lsp_diagnostics_float_delay),

This way CursorMoved still hides the float immediately (existing behavior), and only CursorHold close behavior becomes configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants