aboutsummaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-09-25 15:37:18 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2024-09-25 15:41:25 +0200
commit586a7defebd685dfc9f0ad251605389b5b4915e5 (patch)
treef7f77b315bbffa6e1e570fe2d8165f1a31fd8eda /init.lua
parent54cc2066f73749f80e89a8220561406ab781c17f (diff)
downloadvis-lspc-586a7defebd685dfc9f0ad251605389b5b4915e5.tar.gz
vis-lspc-586a7defebd685dfc9f0ad251605389b5b4915e5.zip
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.
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua2
1 files changed, 1 insertions, 1 deletions
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)},