From 3b5ad77f96d1e1844dcbcd65443caac52159c238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 11 Jun 2021 20:27:05 +0800 Subject: stash --- script/core/searcher.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'script/core') 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) } -- cgit v1.2.3