diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-07-08 18:27:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-07-08 18:27:12 +0800 |
commit | ef87faf3cfca7654095b2c167e0faa20837b1080 (patch) | |
tree | 9a734bf2b93e95b7996edda53cb7b9ce2e35659e /script/core | |
parent | 7b67c5d4dc31f0b49994d334e8353ca4430224d3 (diff) | |
download | lua-language-server-ef87faf3cfca7654095b2c167e0faa20837b1080.zip |
#189 查看字符串的设置
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/hover/hover.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/script/core/hover/hover.lua b/script/core/hover/hover.lua index d3a1a155..7e837698 100644 --- a/script/core/hover/hover.lua +++ b/script/core/hover/hover.lua @@ -4,6 +4,7 @@ local getFunctionHoverAsLib = require 'core.hover.lib_function' local getFunctionHoverAsEmmy = require 'core.hover.emmy_function' local buildValueName = require 'core.hover.name' local lang = require 'language' +local config = require 'config' local OriginTypes = { ['any'] = true, @@ -326,10 +327,13 @@ local function hoverAsString(source) end -- 内部包含转义符? local rawLen = source.finish - source.start - 2 * #source[2] + 1 - if (source[2] == '"' or source[2] == "'") and rawLen > #str then + if config.config.hover.viewString + and (source[2] == '"' or source[2] == "'") + and rawLen > #str then local view = str - if #view > 1000 then - view = view:sub(1, 1000) .. '...' + local max = config.config.hover.viewStringMax + if #view > max then + view = view:sub(1, max) .. '...' end lines[#lines+1] = ([[ |