diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-08-17 17:55:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-08-17 17:55:12 +0800 |
commit | 1ad4e66d410ac0bbca7ebdd4ab1ec5f7dc47af1c (patch) | |
tree | 17a98ded980d958c6e7e31979bd28e106f158812 /script-beta/core/hover/label.lua | |
parent | faab8b0541b7eb3a955dfc231f91364f78d0fcb6 (diff) | |
download | lua-language-server-1ad4e66d410ac0bbca7ebdd4ab1ec5f7dc47af1c.zip |
整理 hover 的代码
Diffstat (limited to 'script-beta/core/hover/label.lua')
-rw-r--r-- | script-beta/core/hover/label.lua | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua index 12c175cd..57b2ee8e 100644 --- a/script-beta/core/hover/label.lua +++ b/script-beta/core/hover/label.lua @@ -19,36 +19,15 @@ end local function asValue(source, title) local name = buildName(source) local class = 'any' - local type = 'any' - local literal = '' - local cont local infers = vm.getInfers(source) - if infers then - for _, value in ipairs(infers) do - local src = value.source - local tp = value.type - class = guide.mergeTypes {class, vm.getClass(src)} - type = guide.mergeTypes {type, tp} - local sl = guide.getLiteral(src) - if sl then - literal = guide.mergeTypes {literal, util.viewLiteral(sl)} - end - if tp == 'table' then - cont = buildTable(src) - end - end + local type = vm.getType(source) + local literal = vm.getLiteral(source) + local cont + if vm.hasType(source, 'table') then + cont = buildTable(source) end - vm.eachDef(source, function (src) - class = guide.mergeTypes {class, vm.getClass(src)} - type = guide.mergeTypes {type, vm.getType(src)} - local sl = guide.getLiteral(src) - if sl then - literal = guide.mergeTypes {literal, util.viewLiteral(sl)} - end - if type == 'table' then - cont = buildTable(src) - end - end) + --vm.eachDef(source, function (src) + --end) local pack = {} pack[#pack+1] = title pack[#pack+1] = name .. ':' |