summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/config.lua3
-rw-r--r--script/core/hover/table.lua21
2 files changed, 14 insertions, 10 deletions
diff --git a/script/config.lua b/script/config.lua
index 50aab037..1287681c 100644
--- a/script/config.lua
+++ b/script/config.lua
@@ -175,8 +175,7 @@ local ConfigTemplate = {
viewString = {true, Boolean},
viewStringMax = {1000, Integer},
viewNumber = {true, Boolean},
- fieldInfer = {3000, Integer},
- previewFields = {100, Integer},
+ previewFields = {20, Integer},
enumsLimit = {5, Integer},
},
color = {
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua
index 159453e6..8bcce0ae 100644
--- a/script/core/hover/table.lua
+++ b/script/core/hover/table.lua
@@ -1,9 +1,8 @@
local vm = require 'vm'
local util = require 'utility'
-local searcher = require 'core.searcher'
local config = require 'config'
-local lang = require 'language'
local infer = require 'core.infer'
+local await = require 'await'
local function formatKey(key)
if type(key) == 'string' then
@@ -28,8 +27,8 @@ local function buildAsHash(keys, inferMap, literalMap, reachMax)
lines[#lines+1] = (' %s: %s,'):format(formatKey(key), inferView)
end
end
- if reachMax then
- lines[#lines+1] = ' ...'
+ if reachMax > 0 then
+ lines[#lines+1] = (' ...(+%d)'):format(reachMax)
end
lines[#lines+1] = '}'
return table.concat(lines, '\n')
@@ -50,8 +49,8 @@ local function buildAsConst(keys, inferMap, literalMap, reachMax)
lines[#lines+1] = (' %s: %s,'):format(formatKey(key), inferView)
end
end
- if reachMax then
- lines[#lines+1] = ' ...'
+ if reachMax > 0 then
+ lines[#lines+1] = (' ...(+%d)'):format(reachMax)
end
lines[#lines+1] = '}'
return table.concat(lines, '\n')
@@ -107,10 +106,16 @@ return function (source)
local inferMap = {}
local literalMap = {}
- local reachMax = maxFields < #keys
+ local reachMax = #keys - maxFields
+ if #keys > maxFields then
+ for i = maxFields + 1, #keys do
+ keys[i] = nil
+ end
+ end
local isConsts = true
- for i = 1, math.min(maxFields, #keys) do
+ for i = 1, #keys do
+ await.delay()
local key = keys[i]
inferMap[key] = infer.searchAndViewInfers(source, key)
literalMap[key] = infer.searchAndViewLiterals(source, key)