Skip to content

perf(lsp): batch progress updates and coalesce redraws - #297

Merged
fcoury-oai merged 1 commit into
mainfrom
fcoury/lsp-progress-batching
Aug 21, 2026
Merged

perf(lsp): batch progress updates and coalesce redraws#297
fcoury-oai merged 1 commit into
mainfrom
fcoury/lsp-progress-batching

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Why

#293 restored LSP work-done progress, but the editor handled only one incoming LSP message per 10 ms background tick. A progress burst could therefore hold an already-available hover, completion, or diagnostic response for more than a second. Progress notifications also triggered full redraws even when Fidget was disabled.

What changed

  • Drain up to 64 queued LSP messages per background tick while retaining a bounded fairness budget.
  • Recognize progress notifications before plugin dispatch, so they redraw only when a listener actually changes visible UI.
  • Coalesce Fidget overlay updates into the existing end-of-tick redraw.
  • Add deterministic regressions for queued hover responses, numeric and string progress tokens without Fidget, the 64-message budget, and a single Fidget redraw per burst.

A controlled debug-build probe queued 100 synthetic progress updates immediately before an available hover response:

Configuration Before After
Fidget disabled 1,202 ms 21 ms
Fidget enabled 1,355 ms 135 ms

How to Test

  1. Run the focused queueing and redraw regressions:

    cargo test -p red --lib lsp_progress
    cargo test -p red --lib fidget_progress_burst_coalesces_overlay_updates_into_one_redraw
    cargo test -p red --test lsp_lazy

    Expect queued hover responses to complete in one background pass, a 65th message to remain queued for fairness, progress without Fidget to cause no redraw, and a Fidget burst to produce one redraw.

  2. Open a Rust workspace, trigger K while rust-analyzer is indexing, and confirm hover appears promptly while the Fidget overlay continues to update.

  3. Add disabled_plugins = ["fidget"] to the top level of the user config, repeat the same hover request during indexing, and confirm progress-only notifications no longer repaint the editor.

Also verified: 2,077 library tests, 48 LSP integration tests, formatting, and cargo clippy --all-targets --all-features -- -D warnings.

@fcoury-oai
fcoury-oai merged commit f30f0b0 into main Aug 21, 2026
10 checks passed
@fcoury-oai
fcoury-oai deleted the fcoury/lsp-progress-batching branch August 21, 2026 20:45
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.

1 participant