summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-11-05 21:03:59 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-11-05 21:03:59 +0800
commit88f4308a520298c9399850a23dd5f1ae05164334 (patch)
tree327167142a3c879cc91b17a7e83509a5d589a092
parent6f927f4fa9a7c6e0446755a3f6aa86570c684754 (diff)
downloadlua-language-server-88f4308a520298c9399850a23dd5f1ae05164334.zip
table的hover最多只显示1000个字段
-rw-r--r--script-beta/core/hover/table.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua
index ff4012bb..e484553b 100644
--- a/script-beta/core/hover/table.lua
+++ b/script-beta/core/hover/table.lua
@@ -229,6 +229,7 @@ return function (source)
local timeUp
local mark = {}
local fields = vm.getFields(source, 'deep')
+ local keyCount = 0
for _, src in ipairs(fields) do
local key = getKey(src)
if not key then
@@ -236,6 +237,7 @@ return function (source)
end
if not classes[key] then
classes[key] = {}
+ keyCount = keyCount + 1
end
if not literals[key] then
literals[key] = {}
@@ -249,6 +251,9 @@ return function (source)
end
classes[key][#classes[key]+1] = class
literals[key][#literals[key]+1] = literal
+ if keyCount >= 1000 then
+ break
+ end
::CONTINUE::
end