summaryrefslogtreecommitdiff
path: root/script/core
diff options
context:
space:
mode:
authorRuin0x11 <ipickering2@gmail.com>2020-05-25 19:16:45 -0700
committerRuin0x11 <ipickering2@gmail.com>2020-05-25 19:25:36 -0700
commit9dc816f99f4a4329a3daff55a7199a8265a00c2c (patch)
treed400a9cb6f1a897913ff9fe56d7d0e83c45c078b /script/core
parent0583236680b16588c52c7c98ac5a3f8a7071b868 (diff)
downloadlua-language-server-9dc816f99f4a4329a3daff55a7199a8265a00c2c.zip
Support multiple workspace folders
Diffstat (limited to 'script/core')
-rw-r--r--script/core/completion.lua16
-rw-r--r--script/core/hover/hover.lua8
2 files changed, 20 insertions, 4 deletions
diff --git a/script/core/completion.lua b/script/core/completion.lua
index 6b503bd5..a62a5f1c 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -663,14 +663,21 @@ local function buildTextEdit(start, finish, str, quo)
}
end
+--- @param vm VM
+--- @param source table
+--- @param callback function
local function searchInRequire(vm, source, callback)
- if not vm.lsp or not vm.lsp.workspace then
+ if not vm.lsp then
+ return
+ end
+ local ws = vm.lsp:findWorkspaceFor(vm.uri)
+ if not ws then
return
end
if source.type ~= 'string' then
return
end
- local list, map = vm.lsp.workspace:matchPath(vm.uri, source[1])
+ local list, map = ws:matchPath(vm.uri, source[1])
if not list then
return
end
@@ -1039,6 +1046,11 @@ local function getSource(vm, pos, text, filter)
return source, pos, word
end
+--- @param vm VM
+--- @param text string
+--- @param pos table
+--- @param oldText string
+--- @return table
return function (vm, text, pos, oldText)
local filter = {
['name'] = true,
diff --git a/script/core/hover/hover.lua b/script/core/hover/hover.lua
index 2ee5cf46..1e8cf4d1 100644
--- a/script/core/hover/hover.lua
+++ b/script/core/hover/hover.lua
@@ -294,10 +294,14 @@ end
local function hoverAsTargetUri(source, lsp)
local uri = source:get 'target uri'
- if not lsp or not lsp.workspace then
+ if not lsp then
return nil
end
- local path = lsp.workspace:relativePathByUri(uri)
+ local ws = lsp:findWorkspaceFor(uri)
+ if not ws then
+ return nil
+ end
+ local path = ws:relativePathByUri(uri)
if not path then
return nil
end