diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 23:11:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-11-20 23:11:18 +0800 |
commit | 829dcb1964491f1e10afa73a4f8444cdbc487a9f (patch) | |
tree | c373da7f6c19b3fa11c23ed2d8987dbff804c2f3 /script | |
parent | 08d38c50e06663622264ae8c64bc8dd2092f63e1 (diff) | |
download | lua-language-server-829dcb1964491f1e10afa73a4f8444cdbc487a9f.zip |
hover of table fields use doc first
Diffstat (limited to 'script')
-rw-r--r-- | script/core/hover/table.lua | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/script/core/hover/table.lua b/script/core/hover/table.lua index 02be5271..f26731be 100644 --- a/script/core/hover/table.lua +++ b/script/core/hover/table.lua @@ -32,7 +32,20 @@ local function getKey(src) return ('[%s]'):format(key) end +local function getFieldFull(src) + local tp = vm.getInferType(src) + --local class = vm.getClass(src) + local literal = vm.getInferLiteral(src) + if type(literal) == 'string' and #literal >= 50 then + literal = literal:sub(1, 47) .. '...' + end + return tp, literal +end + local function getFieldFast(src) + if src.bindDocs then + return getFieldFull(src) + end local value = guide.getObjectValue(src) or src if not value then return 'any' @@ -63,16 +76,6 @@ local function getFieldFast(src) end end -local function getFieldFull(src) - local tp = vm.getInferType(src) - --local class = vm.getClass(src) - local literal = vm.getInferLiteral(src) - if type(literal) == 'string' and #literal >= 50 then - literal = literal:sub(1, 47) .. '...' - end - return tp, literal -end - local function getField(src, timeUp, mark, key) if src.type == 'table' or src.type == 'function' then |