From b777ef7207c3dee575355f78d019b4ff2f0fb460 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 22 May 2024 12:12:52 +0200 Subject: fix open file tracking after didClose Properly remove the reference to the language server to which we send the didClose notification. Additionally, remove the open file reference if this was the last language server for the closed file. Fixes: 3c4b876ce21be2928c1bab33856d2294e6b43f5b --- init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index ddad310..7073136 100644 --- a/init.lua +++ b/init.lua @@ -1204,7 +1204,10 @@ local function lspc_close(ls, file) ls_send_notification(ls, 'textDocument/didClose', { textDocument = {uri = path_to_uri(file.path)}, }) - lspc.open_files[file.path][ls] = nil + lspc.open_files[file.path].language_servers[ls] = nil + if not next(lspc.open_files[file.path].language_servers) then + lspc.open_files[file.path] = nil + end end -- register a file as open with a language server and setup close and save event handlers -- cgit v1.2.3