Skip to content

fix(#2954): more efficient LSP updates, increase diagnostics.debounce_delay from 50ms to 500ms#3007

Merged
alex-courtis merged 3 commits intomasterfrom
2954-remove-unnecessary-lsp-updates
Nov 21, 2024
Merged

fix(#2954): more efficient LSP updates, increase diagnostics.debounce_delay from 50ms to 500ms#3007
alex-courtis merged 3 commits intomasterfrom
2954-remove-unnecessary-lsp-updates

Conversation

@alex-courtis
Copy link
Member

@alex-courtis alex-courtis commented Nov 18, 2024

fixes #2954

@des-b I'd be most grateful for your review and thoughts.

This changes the approach to LSP:

  • examine the DiagnosticChanged data on the event (sync) thread
  • NODE_SEVERITIES and NODE_SEVERITIES_VERSION only updated on delta
  • on delta a redraw is scheduled

The debounce delay was increased as there are a lot of events as the user types.

It's not clear whether a full redraw R is needed; it could clear NODE_SEVERITIES and rebuild it. YAGNI?

local node_contains_buf = vim.startswith(bufname, nodepath .. "/")
if node_contains_buf then
if severity == M.severity.max then
if not max_severity or severity < max_severity then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This became a warning hence it was simplified.


---Absolute Node path to LSP severity level
---@alias NodeSeverities table<string, lsp.DiagnosticSeverity>
---@alias NodeSeverities table<string, vim.diagnostic.Severity>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lsp.DiagnosticSeverity and vim.diagnostic.Severity are effectively the same. It's not clear which is preferred, so I went with the one from vim.Diagnostic

@alex-courtis alex-courtis merged commit 1f3ffd6 into master Nov 21, 2024
@alex-courtis alex-courtis deleted the 2954-remove-unnecessary-lsp-updates branch November 21, 2024 23:12
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.

LSP diagnostics inside nvim-tree may flicker

1 participant