From 55a59e56eda98f17448a1c318a346ae12d30fc05 Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Wed, 5 Jan 2022 08:36:35 -0800 Subject: feat(lsp): enable default debounce of 150 ms (#16908) --- runtime/doc/lsp.txt | 4 ++-- runtime/lua/vim/lsp.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 614dd82443..bb42a87034 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -887,10 +887,10 @@ start_client({config}) *vim.lsp.start_client()* default true): Allow using incremental sync for buffer edits • debounce_text_changes (number, - default nil): Debounce didChange + default 150): Debounce didChange notifications to the server by the given number in milliseconds. No - debounce occurs if nil + debounce occurs if set to 0. • exit_timeout (number, default 500): Milliseconds to wait for server to exit cleanly after sending the diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 72bda63b43..7df0064b6b 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -256,7 +256,7 @@ local function validate_client_config(config) (not config.flags or not config.flags.debounce_text_changes or type(config.flags.debounce_text_changes) == 'number'), - "flags.debounce_text_changes must be nil or a number with the debounce time in milliseconds" + "flags.debounce_text_changes must be a number with the debounce time in milliseconds" ) local cmd, cmd_args = lsp._cmd_parts(config.cmd) @@ -383,8 +383,8 @@ do return end local state = state_by_client[client.id] - local debounce = client.config.flags.debounce_text_changes - if not debounce then + local debounce = client.config.flags.debounce_text_changes or 150 + if debounce == 0 then local changes = state.use_incremental_sync and incremental_changes(client) or full_changes() client.notify("textDocument/didChange", { textDocument = { -- cgit