summaryrefslogtreecommitdiff
path: root/script/vm/global.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-10-17 11:41:20 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-10-17 11:41:20 +0800
commit6b04f490fc0c45a0e3a70f3ca27c976f70b620c1 (patch)
treec003e08e2f3548573f9481f9913e335aab00fad1 /script/vm/global.lua
parent33b0d6673c146dcf6a42f01b5c5d21d489fa8dec (diff)
downloadlua-language-server-6b04f490fc0c45a0e3a70f3ca27c976f70b620c1.zip
update workspace-symbol
Diffstat (limited to 'script/vm/global.lua')
-rw-r--r--script/vm/global.lua28
1 files changed, 27 insertions, 1 deletions
diff --git a/script/vm/global.lua b/script/vm/global.lua
index 590264bd..29474b57 100644
--- a/script/vm/global.lua
+++ b/script/vm/global.lua
@@ -42,7 +42,7 @@ function mt:addGet(uri, source)
self.getsCache = nil
end
----@param suri uri
+---@param suri uri
---@return parser.object[]
function mt:getSets(suri)
if not self.setsCache then
@@ -73,6 +73,27 @@ function mt:getSets(suri)
end
---@return parser.object[]
+function mt:getAllSets()
+ if not self.setsCache then
+ self.setsCache = {}
+ end
+ local cache = self.setsCache['*']
+ if cache then
+ return cache
+ end
+ cache = {}
+ self.setsCache['*'] = cache
+ for _, link in pairs(self.links) do
+ if link.sets then
+ for _, source in ipairs(link.sets) do
+ cache[#cache+1] = source
+ end
+ end
+ end
+ return cache
+end
+
+---@return parser.object[]
function mt:getGets(suri)
if not self.getsCache then
self.getsCache = {}
@@ -467,6 +488,11 @@ function vm.getGlobals(cate)
return globals
end
+---@return table<string, vm.global>
+function vm.getAllGlobals()
+ return allGlobals
+end
+
---@param suri uri
---@param cate vm.global.cate
---@return parser.object[]