diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-10-29 20:43:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-10-29 20:43:01 +0800 |
commit | d5ecec7f362db69879e5097e41bd334d76260783 (patch) | |
tree | 1b14ddf979adfb684a49d7db9d640b35d224c338 /script-beta/vm/eachDef.lua | |
parent | e98483d89ac38463cf5b717a3b19861baf8f3e94 (diff) | |
download | lua-language-server-d5ecec7f362db69879e5097e41bd334d76260783.zip |
整理代码
Diffstat (limited to 'script-beta/vm/eachDef.lua')
-rw-r--r-- | script-beta/vm/eachDef.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/script-beta/vm/eachDef.lua b/script-beta/vm/eachDef.lua index 46d1887e..5d1aa566 100644 --- a/script-beta/vm/eachDef.lua +++ b/script-beta/vm/eachDef.lua @@ -4,7 +4,7 @@ local files = require 'files' local util = require 'utility' local await = require 'await' -local function eachDef(source, simple) +local function eachDef(source, deep) local results = {} local lock = vm.lock('eachDef', source) if not lock then @@ -14,7 +14,7 @@ local function eachDef(source, simple) await.delay() local clock = os.clock() - local myResults, count = guide.requestDefinition(source, vm.interface, simple) + local myResults, count = guide.requestDefinition(source, vm.interface, deep) 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 @@ -30,15 +30,15 @@ function vm.getDefs(source, deep) local name = guide.getKeyName(source) local cache = vm.getCache('eachDefOfGlobal')[name] or vm.getCache('eachDef')[source] - or eachDef(source, deep) + or eachDef(source, 'deep') vm.getCache('eachDefOfGlobal')[name] = cache return cache - elseif not deep then - return eachDef(source, deep) else local cache = vm.getCache('eachDef')[source] or eachDef(source, deep) - vm.getCache('eachDef')[source] = cache + if deep then + vm.getCache('eachDef')[source] = cache + end return cache end end |