diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-21 20:52:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-21 20:52:05 +0800 |
commit | ca322946af06afa7bfd93fa176812ceed854730e (patch) | |
tree | e32e54acea059359a27ecf35c9ab305d8a5e0f51 /script-beta/vm/eachDef.lua | |
parent | 0bb3565ed9e8f3fb0d9501f7ac2b3c7aa0245a86 (diff) | |
download | lua-language-server-ca322946af06afa7bfd93fa176812ceed854730e.zip |
优化性能
Diffstat (limited to 'script-beta/vm/eachDef.lua')
-rw-r--r-- | script-beta/vm/eachDef.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index 320f3e97..ec3930ed 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -6,8 +6,8 @@ local await = require 'await' local m = {} -function m.eachDef(source, results) - results = results or {} +function m.eachDef(source, simple) + local results = {} local lock = vm.lock('eachDef', source) if not lock then return results @@ -16,7 +16,7 @@ function m.eachDef(source, results) await.delay() local clock = os.clock() - local myResults, count = guide.requestDefinition(source, vm.interface) + local myResults, count = guide.requestDefinition(source, vm.interface, simple) if DEVELOP and os.clock() - clock > 0.1 then log.warn('requestDefinition', count, os.clock() - clock, guide.getUri(source), util.dump(source, { deep = 1 })) end @@ -27,7 +27,7 @@ function m.eachDef(source, results) return results end -function vm.getDefs(source) +function vm.getDefs(source, simple) if guide.isGlobal(source) then local name = guide.getKeyName(source) local cache = vm.getCache('eachDefOfGlobal')[name] @@ -35,6 +35,8 @@ function vm.getDefs(source) or m.eachDef(source) vm.getCache('eachDefOfGlobal')[name] = cache return cache + elseif simple then + return m.eachDef(source, simple) else local cache = vm.getCache('eachDef')[source] or m.eachDef(source) |