diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-18 19:48:11 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-18 19:48:11 +0800 |
commit | 2c461c6fc0a46b9ef44293dc9d8524b60d5c1f75 (patch) | |
tree | 0092508b2a9244d6a876d2f4cb3a5b124aefeb20 /script/core | |
parent | 78e9c078f77fce1f7d6816a0904e38f45a0164e4 (diff) | |
download | lua-language-server-2c461c6fc0a46b9ef44293dc9d8524b60d5c1f75.zip |
no more ID cache
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/noder.lua | 12 | ||||
-rw-r--r-- | script/core/searcher.lua | 2 |
2 files changed, 1 insertions, 13 deletions
diff --git a/script/core/noder.lua b/script/core/noder.lua index 2ef34e80..89be1e62 100644 --- a/script/core/noder.lua +++ b/script/core/noder.lua @@ -3,8 +3,6 @@ local guide = require 'parser.guide' local collector = require 'core.collector' local files = require 'files' -local LastIDCache = {} -local FirstIDCache = {} local SPLIT_CHAR = '\x1F' local LAST_REGEX = SPLIT_CHAR .. '[^' .. SPLIT_CHAR .. ']*$' local FIRST_REGEX = '^[^' .. SPLIT_CHAR .. ']*' @@ -972,15 +970,10 @@ end ---@param id string ---@return string function m.getFirstID(id) - if FirstIDCache[id] then - return FirstIDCache[id] or nil - end local firstID, count = id:match(FIRST_REGEX) if count == 0 then - FirstIDCache[id] = false return nil end - FirstIDCache[id] = firstID return firstID end @@ -988,15 +981,10 @@ end ---@param id string ---@return string function m.getLastID(id) - if LastIDCache[id] then - return LastIDCache[id] or nil - end local lastID, count = id:gsub(LAST_REGEX, '') if count == 0 then - LastIDCache[id] = false return nil end - LastIDCache[id] = lastID return lastID end diff --git a/script/core/searcher.lua b/script/core/searcher.lua index 75176961..ee8af71a 100644 --- a/script/core/searcher.lua +++ b/script/core/searcher.lua @@ -200,7 +200,7 @@ local function crossSearch(status, uri, expect, mode, sourceUri) end local function checkCache(status, uri, expect, mode) - local cache = vm.getCache('search:' .. mode) + local cache = vm.getCache('search:' .. mode, true) local fileCache = cache[uri] if not fileCache then fileCache = {} |