diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-28 16:59:58 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-28 16:59:58 +0800 |
commit | 697aa9822b989d670c38bab8b4a0c25352a1b316 (patch) | |
tree | 26ee36e3575a4bd4eaf84e4a17fe8d4cdfd8f3b0 /script-beta/vm/getLibrary.lua | |
parent | eec3341dcba8b4076a038827aad3869a1439058b (diff) | |
download | lua-language-server-697aa9822b989d670c38bab8b4a0c25352a1b316.zip |
允许在索引过程中访问库
Diffstat (limited to 'script-beta/vm/getLibrary.lua')
-rw-r--r-- | script-beta/vm/getLibrary.lua | 18 |
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) |