summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-30 15:54:20 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-30 15:54:20 +0800
commit908feedce35b056c38fab57fd4e32727b117479c (patch)
tree14facde20e4f1f08876194f3ac62e31d492f01da /script
parent69a3ce64e5032f036d054ae435a8c523996567ed (diff)
downloadlua-language-server-908feedce35b056c38fab57fd4e32727b117479c.zip
resolve #507 new setting `hover.enumsLimit`
Diffstat (limited to 'script')
-rw-r--r--script/config.lua1
-rw-r--r--script/core/guide.lua11
-rw-r--r--script/proto/define.lua3
3 files changed, 11 insertions, 4 deletions
diff --git a/script/config.lua b/script/config.lua
index a133cf1c..8bc05b98 100644
--- a/script/config.lua
+++ b/script/config.lua
@@ -176,6 +176,7 @@ local ConfigTemplate = {
viewNumber = {true, Boolean},
fieldInfer = {3000, Integer},
previewFields = {100, Integer},
+ enumsLimit = {5, Integer},
},
color = {
mode = {'Semantic', String},
diff --git a/script/core/guide.lua b/script/core/guide.lua
index b80a3628..367b91e2 100644
--- a/script/core/guide.lua
+++ b/script/core/guide.lua
@@ -1,4 +1,6 @@
local util = require 'utility'
+local config = require 'config'
+local lang = require 'language'
local error = error
local type = type
local next = next
@@ -3396,7 +3398,14 @@ function m.mergeTypes(types)
end
end)
- return tableConcat(results, '|')
+ local enumsLimit = config.config.hover.enumsLimit
+ if #results > enumsLimit then
+ return tableConcat(results, '|', 1, enumsLimit)
+ .. lang.script('HOVER_MORE_ENUMS', #results - enumsLimit)
+ else
+ return tableConcat(results, '|')
+ end
+
end
function m.getClassExtends(class)
diff --git a/script/proto/define.lua b/script/proto/define.lua
index 15e434de..abfaa9b0 100644
--- a/script/proto/define.lua
+++ b/script/proto/define.lua
@@ -1,6 +1,3 @@
-local guide = require 'core.guide'
-local util = require 'utility'
-
local m = {}
---@alias location table