diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-07-21 19:36:55 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-07-21 19:36:55 +0800 |
commit | 100bea883a79b4d57e413c7eb2dfcf7b112b2ec5 (patch) | |
tree | a3f8585ce2b04c3a34d81369b4ab078688b06ba3 /script/method | |
parent | 7a9f26241cec312c0c7930bcc71ca4f70a31facc (diff) | |
download | lua-language-server-100bea883a79b4d57e413c7eb2dfcf7b112b2ec5.zip |
给单开文件加个假的工作目录
Diffstat (limited to 'script/method')
-rw-r--r-- | script/method/textDocument/didOpen.lua | 5 |
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 |