summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-05-26 13:51:26 +0800
committerGitHub <noreply@github.com>2020-05-26 13:51:26 +0800
commitd7b7bd258df58c8b9fea5d5ac110975e7387cd9c (patch)
treed400a9cb6f1a897913ff9fe56d7d0e83c45c078b /script/vm
parent0583236680b16588c52c7c98ac5a3f8a7071b868 (diff)
parent9dc816f99f4a4329a3daff55a7199a8265a00c2c (diff)
downloadlua-language-server-d7b7bd258df58c8b9fea5d5ac110975e7387cd9c.zip
Merge pull request #167 from Ruin0x11/multi-workspace
Support multiple workspace folders
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/vm.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/script/vm/vm.lua b/script/vm/vm.lua
index 36ad78c9..d0caa8a9 100644
--- a/script/vm/vm.lua
+++ b/script/vm/vm.lua
@@ -168,7 +168,11 @@ function mt:callSetMetaTable(func, values, source)
end
function mt:tryRequireOne(str, strValue, mode)
- if not self.lsp or not self.lsp.workspace then
+ if not self.lsp then
+ return nil
+ end
+ local ws = self.lsp:findWorkspaceFor(self:getUri())
+ if not ws then
return nil
end
local strSource = strValue:getSource()
@@ -180,11 +184,11 @@ function mt:tryRequireOne(str, strValue, mode)
self:instantSource(strSource)
local uri
if mode == 'require' then
- uri = self.lsp.workspace:searchPath(self:getUri(), str)
+ uri = ws:searchPath(self:getUri(), str)
elseif mode == 'loadfile' then
- uri = self.lsp.workspace:loadPath(self:getUri(), str)
+ uri = ws:loadPath(self:getUri(), str)
elseif mode == 'dofile' then
- uri = self.lsp.workspace:loadPath(self:getUri(), str)
+ uri = ws:loadPath(self:getUri(), str)
end
if not uri then
return nil