diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-01-05 19:58:44 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-01-05 19:58:44 +0800 |
commit | eec9fdc3958727afa740fa844eba7955072d3e24 (patch) | |
tree | 87c997420aad1dde047bfdfa36b84957f59fea3c /script/workspace | |
parent | 81f4f7e45dfdea5f54d6f2265b0ab201cd91dd36 (diff) | |
download | lua-language-server-eec9fdc3958727afa740fa844eba7955072d3e24.zip |
improve performance
Diffstat (limited to 'script/workspace')
-rw-r--r-- | script/workspace/workspace.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index f99092bc..0f2b3f09 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -17,6 +17,7 @@ m.nativeVersion = -1 m.libraryVersion = -1 m.nativeMatcher = nil m.requireCache = {} +m.cache = {} m.matchOption = { ignoreCase = platform.OS == 'Windows', } @@ -258,6 +259,7 @@ function m.awaitPreload() await.setID 'preload' m.libraryMatchers = nil m.nativeMatcher = nil + m.cache = {} local progress = { max = 0, read = 0, @@ -413,6 +415,14 @@ function m.getRelativePath(uri) end end +--- 获取工作区等级的缓存 +function m.getCache(name) + if not m.cache[name] then + m.cache[name] = {} + end + return m.cache[name] +end + function m.reload() local rpath = require 'workspace.require-path' files.flushAllLibrary() |