diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-11 18:43:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-11 18:43:13 +0800 |
commit | 710ca85aebe3b761e8f03462651ba8ecf629518a (patch) | |
tree | 48565c777be10496275357f0cd6a0701bef27ef9 /script/core | |
parent | 650af818eb185d3261648cac615e9f8ce99b0d50 (diff) | |
download | lua-language-server-710ca85aebe3b761e8f03462651ba8ecf629518a.zip |
stash
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/searcher.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 73e9ca0f..c782e68c 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -430,6 +430,7 @@ function m.searchRefsByID(status, uri, expect, mode) if not uris then return end + local clock = os.clock() local isCall = id:sub(#firstID + 2, #firstID + 2) == noder.RETURN_INDEX local tid = id .. (field or '') for guri, def in pairs(uris) do @@ -452,6 +453,10 @@ function m.searchRefsByID(status, uri, expect, mode) crossSearch(status, guri, tid, mode) ::CONTINUE:: end + local passed = os.clock() - clock + if passed > 0.1 then + print('全局变量耗时:', passed, id, field, tid, mode) + end end local function checkClass(id, node, field) @@ -530,7 +535,9 @@ function m.searchRefsByID(status, uri, expect, mode) local stepCount = 0 function searchStep(id, field) stepCount = stepCount + 1 - if stepCount > 1000 then + --status.count = status.count + 1 + if stepCount > 1000 + or status.count > 10000 then if TEST then error('too large!') else @@ -749,6 +756,7 @@ function m.status(mode) lock = {}, results = {}, mark = {}, + count = 0, cache = vm.getCache('searcher:' .. mode) } return status |