From 6b04f490fc0c45a0e3a70f3ca27c976f70b620c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 17 Oct 2022 11:41:20 +0800 Subject: update workspace-symbol --- script/vm/global.lua | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'script/vm/global.lua') 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 @@ -72,6 +72,27 @@ function mt:getSets(suri) return cache 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 @@ -467,6 +488,11 @@ function vm.getGlobals(cate) return globals end +---@return table +function vm.getAllGlobals() + return allGlobals +end + ---@param suri uri ---@param cate vm.global.cate ---@return parser.object[] -- cgit v1.2.3