summaryrefslogtreecommitdiff
path: root/script-beta/vm/vm.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-05-29 18:43:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-05-29 18:43:41 +0800
commit56660210803cd9128d52007fe14b0b0f5a726ff5 (patch)
treeb18f22fe382e15c99cdbc1966544b12245056edb /script-beta/vm/vm.lua
parent0c009afbc73804259e1da0cf2b7a6a69ca728cee (diff)
downloadlua-language-server-56660210803cd9128d52007fe14b0b0f5a726ff5.zip
整理代码
Diffstat (limited to 'script-beta/vm/vm.lua')
-rw-r--r--script-beta/vm/vm.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/script-beta/vm/vm.lua b/script-beta/vm/vm.lua
index 556de3df..93641f86 100644
--- a/script-beta/vm/vm.lua
+++ b/script-beta/vm/vm.lua
@@ -136,6 +136,27 @@ function m.getKeyName(source)
return guide.getKeyName(source)
end
+function m.eachDef(source, callback)
+ local results = guide.requestDefinition(source)
+ for i = 1, #results do
+ callback(results[i])
+ end
+end
+
+function m.eachRef(source, callback)
+ local results = guide.requestReference(source)
+ for i = 1, #results do
+ callback(results[i])
+ end
+end
+
+function m.eachField(source, callback)
+ local results = guide.requestFields(source)
+ for i = 1, #results do
+ callback(results[i])
+ end
+end
+
m.cacheTracker = setmetatable({}, { __mode = 'kv' })
--- 刷新缓存