diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-23 16:22:13 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-23 16:22:13 +0800 |
commit | ac1bddb7ca2f3b497085b06f310280f7d7ec0fb3 (patch) | |
tree | 2a4b5bb7fe21d258e7e31589e146e610ffbab0e1 /script | |
parent | 366d163edf1373ca4f7c56ef44b77b818d9ee4f8 (diff) | |
download | lua-language-server-ac1bddb7ca2f3b497085b06f310280f7d7ec0fb3.zip |
fix #571
Diffstat (limited to 'script')
-rw-r--r-- | script/core/infer.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/script/core/infer.lua b/script/core/infer.lua index 6a795dd4..d3145a2e 100644 --- a/script/core/infer.lua +++ b/script/core/infer.lua @@ -2,7 +2,7 @@ local searcher = require 'core.searcher' local config = require 'config' local noder = require 'core.noder' local util = require 'utility' -local vm = require "vm.vm" +local vm = require "vm.vm" local STRING_OR_TABLE = {'STRING_OR_TABLE'} local BE_RETURN = {'BE_RETURN'} @@ -296,7 +296,14 @@ function m.viewInfers(infers) return sa < sb end end) - infers[0] = table.concat(result, '|') + local limit = config.config.hover.enumsLimit + if limit < 0 then + limit = 0 + end + infers[0] = table.concat(result, '|', 1, math.min(count, limit)) + if count > limit then + infers[0] = ('%s...(+%d)'):format(infers[0], count - limit) + end return infers[0] end |