diff options
-rw-r--r-- | .vscode/settings.json | 3 | ||||
-rw-r--r-- | script/core/searcher.lua | 25 | ||||
-rw-r--r-- | test.lua | 3 |
3 files changed, 28 insertions, 3 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 4a3d7d12..2472edc8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,7 +14,8 @@ "tracy", "LOCALE", "SHOWSOURCE", - "TRACE" + "TRACE", + "FOOTPRINT" ], "Lua.diagnostics.disable": [ "close-non-object", 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) } @@ -9,6 +9,7 @@ local fs = require 'bee.filesystem' ROOT = fs.path(rootPath) TEST = true DEVELOP = true +FOOTPRINT = true LOGPATH = LOGPATH or (ROOT .. '/log') METAPATH = METAPATH or (ROOT .. '/meta') @@ -89,7 +90,7 @@ local function main() --config.config.intelliSense.searchDepth = 5 loadDocMetas() - test 'full' + --test 'full' require 'bee.platform'.OS = 'Windows' testAll() |