summaryrefslogtreecommitdiff
path: root/script/method/textDocument/didOpen.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/method/textDocument/didOpen.lua')
-rw-r--r--script/method/textDocument/didOpen.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/script/method/textDocument/didOpen.lua b/script/method/textDocument/didOpen.lua
index d9b0de53..732ddacf 100644
--- a/script/method/textDocument/didOpen.lua
+++ b/script/method/textDocument/didOpen.lua
@@ -1,8 +1,13 @@
+local furi = require 'uri'
+
--- @param lsp LSP
--- @param params table
--- @return boolean
return function (lsp, params)
local doc = params.textDocument
+ if #lsp.workspaces == 0 then
+ lsp:addWorkspace('root', furi.encode(furi.decode(doc.uri):parent_path()))
+ end
lsp:open(doc.uri, doc.version, doc.text)
return true
end