aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2022-01-10 17:33:36 +0100
committerGitHub <noreply@github.com>2022-01-10 17:33:36 +0100
commit3f2fbb824e8943f8851920eb375fbf70302658fd (patch)
treed285cc7e8ed2071857af738db17bc74163fdb94c /runtime/lua/vim/lsp.lua
parent69f1f906a0666728aca0b61e1c2e3fe1e04b311b (diff)
downloadrneovim-3f2fbb824e8943f8851920eb375fbf70302658fd.tar.gz
rneovim-3f2fbb824e8943f8851920eb375fbf70302658fd.tar.bz2
rneovim-3f2fbb824e8943f8851920eb375fbf70302658fd.zip
fix(lsp): ensure pending changes are flushed on skipped debounce (#17015)
Follow up to https://github.com/neovim/neovim/pull/16881 Document changes could get sent out of order to the server: 1. on_lines: debounce > 0; add to pending changes; setup timer 2. on_lines: debounce = 0; send new changes immediately 3. timer triggers, sending changes from 1.
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index fb08e54dfc..fc9c991c05 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -413,8 +413,12 @@ do
return
end
local state = state_by_client[client.id]
+ changetracking._reset_timer(state)
local debounce = next_debounce(client.config.flags.debounce_text_changes or 150, state, bufnr)
if debounce == 0 then
+ if state.pending_change then
+ state.pending_change()
+ end
local changes = state.use_incremental_sync and incremental_changes(client) or full_changes()
client.notify("textDocument/didChange", {
textDocument = {
@@ -425,7 +429,6 @@ do
})
return
end
- changetracking._reset_timer(state)
if state.use_incremental_sync then
-- This must be done immediately and cannot be delayed
-- The contents would further change and startline/endline may no longer fit