diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-29 10:31:49 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-29 10:31:49 +0800 |
commit | e6bc239f11c140866898bcb3ff04bd424650e5d6 (patch) | |
tree | f26559336542c5ae822a8e3bc4b5f153a7540c82 /script-beta/vm/getLibrary.lua | |
parent | 20b461ce88af0f9afb8b7296697275a6b1d65e3a (diff) | |
download | lua-language-server-e6bc239f11c140866898bcb3ff04bd424650e5d6.zip |
更快的搜索标准库
Diffstat (limited to 'script-beta/vm/getLibrary.lua')
-rw-r--r-- | script-beta/vm/getLibrary.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/script-beta/vm/getLibrary.lua b/script-beta/vm/getLibrary.lua index 68fb22a9..3a3c1baf 100644 --- a/script-beta/vm/getLibrary.lua +++ b/script-beta/vm/getLibrary.lua @@ -1,5 +1,6 @@ local vm = require 'vm.vm' local guide = require 'parser.guide' +local library = require 'library' local function getLibrary(source, simple) if source.type == 'library' then @@ -8,6 +9,15 @@ local function getLibrary(source, simple) if source.library then return source.library end + if source.type == 'getglobal' + or source.type == 'setglobal' then + if source.node and source.node.type == 'local' then + local lib = library.global[guide.getName(source)] + if lib then + return lib + end + end + end local defs = vm.getDefs(source, simple) for _, def in ipairs(defs) do if def.type == 'library' then |