From 586a7defebd685dfc9f0ad251605389b5b4915e5 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 25 Sep 2024 15:37:18 +0200 Subject: remove assertion that a closed file always has a path When closing any open file we assume it has a baking path. However, especially windows we opened to present markdown messages to the user have no backing path, and thus closing them fail. Fix this assumption and use vis' "[No Name]" if no file path is set. --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 3fcb0e8..53a439f 100644 --- a/init.lua +++ b/init.lua @@ -1169,7 +1169,7 @@ end -- close the file if associated with the language server local function lspc_close(ls, file) if not ls_is_file_opened(ls, file) then - return file.path .. ' not open in ' .. ls.name + return (file.path or '[No Name]') .. ' not open in ' .. ls.name end ls_send_notification(ls, 'textDocument/didClose', { textDocument = {uri = path_to_uri(file.path)}, -- cgit v1.2.3