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 | |
parent | 10a999ff48d18737be710c1308d829b27f9487ae (diff) | |
download | lua-language-server-3b5ad77f96d1e1844dcbcd65443caac52159c238.zip |
stash
-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() |