diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/method/textDocument/didOpen.lua | 5 | ||||
-rw-r--r-- | script/service.lua | 5 |
2 files changed, 7 insertions, 3 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 diff --git a/script/service.lua b/script/service.lua index 208a538f..b5db8080 100644 --- a/script/service.lua +++ b/script/service.lua @@ -784,18 +784,17 @@ function mt:_loadProto() while true do local ok, protoStream = self._proto:pop() if not ok then - goto CONTINUE + break end local suc, proto = xpcall(json.decode, log.error, protoStream) if not suc then - goto CONTINUE + break end if proto.method then self:_doProto(proto) else rpc:recieve(proto) end - ::CONTINUE:: end end |