aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorMathias Fußenegger <mfussenegger@users.noreply.github.com>2022-08-11 19:21:57 +0200
committerGitHub <noreply@github.com>2022-08-11 19:21:57 +0200
commit33b77eb728a1f07926ba19c4f09fd20e806de363 (patch)
tree755e835892f542e593946d4b079b502dfe34c3de /runtime/lua/vim/lsp.lua
parenta27756cc2463139343aa3c214ad20908d42f67a6 (diff)
downloadrneovim-33b77eb728a1f07926ba19c4f09fd20e806de363.tar.gz
rneovim-33b77eb728a1f07926ba19c4f09fd20e806de363.tar.bz2
rneovim-33b77eb728a1f07926ba19c4f09fd20e806de363.zip
fix(lsp): handle nil client in onexit callback (#19722)
Follow up to https://github.com/neovim/neovim/pull/19658
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 10a74ba257..2c62e87513 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -690,7 +690,7 @@ end
--- Default handler for the 'textDocument/didOpen' LSP notification.
---
---@param bufnr number Number of the buffer, or 0 for current
----@param client Client object
+---@param client table Client object
local function text_document_did_open_handler(bufnr, client)
changetracking.init(client, bufnr)
if not vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
@@ -1148,7 +1148,11 @@ function lsp.start_client(config)
active_clients[client_id] = nil
uninitialized_clients[client_id] = nil
- changetracking.reset(client)
+ -- Client can be absent if executable starts, but initialize fails
+ -- init/attach won't have happened
+ if client then
+ changetracking.reset(client)
+ end
if code ~= 0 or (signal ~= 0 and signal ~= 15) then
local msg =
string.format('Client %s quit with exit code %s and signal %s', client_id, code, signal)