diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-11 20:27:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-11 20:27:05 +0800 |
commit | 3b5ad77f96d1e1844dcbcd65443caac52159c238 (patch) | |
tree | c53265f135205e5a97bc7d95b8409620f77cd7ae /script/core | |
parent | 10a999ff48d18737be710c1308d829b27f9487ae (diff) | |
download | lua-language-server-3b5ad77f96d1e1844dcbcd65443caac52159c238.zip |
stash
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/searcher.lua | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 4db87e15..2af09fee 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -4,7 +4,6 @@ local files = require 'files' local generic = require 'core.generic' local ws = require 'workspace' local vm = require 'vm.vm' -local await = require 'await' local globals = require 'vm.globals' local docs = require 'vm.docs' @@ -190,6 +189,9 @@ local function crossSearch(status, uri, expect, mode) if TRACE then log.debug('crossSearch', uri, expect) end + if FOOTPRINT then + status.footprint[#status.footprint+1] = ('cross search:%s %s'):format(uri, expect) + end m.searchRefsByID(status, uri, expect, mode) status.lock[uri] = nil end @@ -239,6 +241,13 @@ function m.searchRefsByID(status, uri, expect, mode) if TRACE then log.debug('search:', id, field) end + if FOOTPRINT then + if field then + status.footprint[#status.footprint+1] = 'search\t' .. id .. '\t' .. field + else + status.footprint[#status.footprint+1] = 'search\t' .. id + end + end if field then if cmark[field] then return @@ -255,6 +264,13 @@ function m.searchRefsByID(status, uri, expect, mode) if TRACE then log.debug('pop:', id, field) end + if FOOTPRINT then + if field then + status.footprint[#status.footprint+1] = 'pop\t' .. id .. '\t' .. field + else + status.footprint[#status.footprint+1] = 'pop\t' .. id + end + end end local function checkLastID(id, field) @@ -545,9 +561,15 @@ function m.searchRefsByID(status, uri, expect, mode) if stepCount > 1000 or status.count > 10000 then if TEST then + if FOOTPRINT then + log.debug(table.concat(status.footprint, '\n')) + end error('too large!') else log.warn('too large!') + if FOOTPRINT then + log.debug(table.concat(status.footprint, '\n')) + end return end end @@ -751,6 +773,7 @@ function m.status(mode) lock = {}, results = {}, mark = {}, + footprint = {}, count = 0, cache = vm.getCache('searcher:' .. mode) } |