summaryrefslogtreecommitdiff
path: root/script-beta/vm/getLibrary.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-08-28 16:59:58 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-08-28 16:59:58 +0800
commit697aa9822b989d670c38bab8b4a0c25352a1b316 (patch)
tree26ee36e3575a4bd4eaf84e4a17fe8d4cdfd8f3b0 /script-beta/vm/getLibrary.lua
parenteec3341dcba8b4076a038827aad3869a1439058b (diff)
downloadlua-language-server-697aa9822b989d670c38bab8b4a0c25352a1b316.zip
允许在索引过程中访问库
Diffstat (limited to 'script-beta/vm/getLibrary.lua')
-rw-r--r--script-beta/vm/getLibrary.lua18
1 files changed, 6 insertions, 12 deletions
diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua
index f9f94bca..a7f0e03a 100644
--- a/script-beta/vm/getLibrary.lua
+++ b/script-beta/vm/getLibrary.lua
@@ -1,20 +1,14 @@
local vm = require 'vm.vm'
-local library = require 'library'
local guide = require 'parser.guide'
-local interface = {
- global = function (name)
- if name:sub(1, 2) == 's|' then
- return library.global[name:sub(3)]
- end
- end,
-}
-
local function getLibrary(source)
- local results = guide.requestDefinition(source, interface)
- for _, def in ipairs(results) do
-
+ local defs = vm.getDefs(source)
+ for _, def in ipairs(defs) do
+ if def.library then
+ return def
+ end
end
+ return nil
end
function vm.getLibrary(source)