summaryrefslogtreecommitdiff
path: root/script-beta/vm/getGlobals.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/getGlobals.lua
parenteec3341dcba8b4076a038827aad3869a1439058b (diff)
downloadlua-language-server-697aa9822b989d670c38bab8b4a0c25352a1b316.zip
允许在索引过程中访问库
Diffstat (limited to 'script-beta/vm/getGlobals.lua')
-rw-r--r--script-beta/vm/getGlobals.lua14
1 files changed, 11 insertions, 3 deletions
diff --git a/script-beta/vm/getGlobals.lua b/script-beta/vm/getGlobals.lua
index 53fff173..69e6dbb7 100644
--- a/script-beta/vm/getGlobals.lua
+++ b/script-beta/vm/getGlobals.lua
@@ -1,6 +1,7 @@
-local guide = require 'parser.guide'
-local vm = require 'vm.vm'
-local files = require 'files'
+local guide = require 'parser.guide'
+local vm = require 'vm.vm'
+local files = require 'files'
+local library = require 'library'
local function getGlobalsOfFile(uri)
local globals = {}
@@ -22,6 +23,12 @@ local function getGlobalsOfFile(uri)
return globals
end
+local function insertLibrary(results, name)
+ if name:sub(1, 2) == 's|' then
+ results[#results+1] = library.global[name:sub(3)]
+ end
+end
+
local function getGlobals(name)
local results = {}
for uri in files:eachFile() do
@@ -33,6 +40,7 @@ local function getGlobals(name)
end
end
end
+ insertLibrary(results, name)
return results
end