diff options
-rw-r--r-- | script/config.lua | 3 | ||||
-rw-r--r-- | script/core/hover/table.lua | 21 | ||||
-rw-r--r-- | test/hover/init.lua | 22 |
3 files changed, 15 insertions, 31 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) diff --git a/test/hover/init.lua b/test/hover/init.lua index 515c3422..a7af112d 100644 --- a/test/hover/init.lua +++ b/test/hover/init.lua @@ -806,27 +806,7 @@ global _G: _G { module: function, next: function, os: oslib, - package: packagelib, - pairs: function, - pcall: function, - print: function, - rawequal: function, - rawget: function, - rawlen: function, - rawset: function, - require: function, - select: function, - setfenv: function, - setmetatable: function, - string: stringlib, - table: tablelib, - tonumber: function, - tostring: function, - type: function, - unpack: function, - utf8: utf8lib, - warn: function, - xpcall: function, + ...(+21) } ]] |