summaryrefslogtreecommitdiff
path: root/script-beta/core/workspace-symbol.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-05 20:55:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-05 20:55:25 +0800
commit6f927f4fa9a7c6e0446755a3f6aa86570c684754 (patch)
treeff86afad2f404c8df68233767fcbbe3d626acabd /script-beta/core/workspace-symbol.lua
parentfe6f1115b5302ddd8ea7ed3e61a222d7294454d0 (diff)
downloadlua-language-server-6f927f4fa9a7c6e0446755a3f6aa86570c684754.zip
优化有大量全局变量时的性能
Diffstat (limited to 'script-beta/core/workspace-symbol.lua')
-rw-r--r--script-beta/core/workspace-symbol.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/script-beta/core/workspace-symbol.lua b/script-beta/core/workspace-symbol.lua
index fb3dd88f..4fc6a854 100644
--- a/script-beta/core/workspace-symbol.lua
+++ b/script-beta/core/workspace-symbol.lua
@@ -2,6 +2,7 @@ local files = require 'files'
local guide = require 'parser.guide'
local matchKey = require 'core.matchkey'
local define = require 'proto.define'
+local await = require 'await'
local function buildSource(uri, source, key, results)
if source.type == 'local'
@@ -58,6 +59,10 @@ return function (key)
for uri in files.eachFile() do
searchFile(files.getOriginUri(uri), key, results)
+ if #results > 1000 then
+ break
+ end
+ await.delay()
end
return results