diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-12-25 17:27:01 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-12-25 17:27:01 +0800 |
commit | 856a4cb27430d6d578a1ee450e7ac4aa13a5f4f1 (patch) | |
tree | 356120ae3713e723e8dca5fdae6314b2d3b63676 /script-beta/core/hover/table.lua | |
parent | 64aab1cc575552ce2ed494790d201d3e6f170065 (diff) | |
download | lua-language-server-856a4cb27430d6d578a1ee450e7ac4aa13a5f4f1.zip |
更新API
Diffstat (limited to 'script-beta/core/hover/table.lua')
-rw-r--r-- | script-beta/core/hover/table.lua | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/script-beta/core/hover/table.lua b/script-beta/core/hover/table.lua index 71f90b97..0cc94103 100644 --- a/script-beta/core/hover/table.lua +++ b/script-beta/core/hover/table.lua @@ -2,24 +2,24 @@ local vm = require 'vm' local util = require 'utility' local getClass = require 'core.hover.class' -local function getKey(info) - if not info.key or #info.key <= 2 then - local source = info.source - if not source.index then +local function getKey(src) + local key = vm.getKeyName(src) + if not key or #key <= 2 then + if not src.index then return '[any]' end - local class = getClass(source.index) + local class = getClass(src.index) if class then return ('[%s]'):format(class) end - local tp = vm.getType(source.index) + local tp = vm.getType(src.index) if tp then return ('[%s]'):format(tp) end return '[any]' end - local ktype = info.key:sub(1, 2) - local key = info.key:sub(3) + local ktype = key:sub(1, 2) + key = key:sub(3) if ktype == 's|' then if key:match '^[%a_][%w_]*$' then return key @@ -30,11 +30,11 @@ local function getKey(info) return ('[%s]'):format(key) end -local function getField(info) - local tp = vm.getType(info.source) - local class = getClass(info.source) - local literal = vm.getLiteral(info.source) - local key = getKey(info) +local function getField(src) + local tp = vm.getType(src) + local class = getClass(src) + local literal = vm.getLiteral(src) + local key = getKey(src) if type(literal) == 'string' and #literal >= 50 then literal = literal:sub(1, 47) .. '...' end @@ -112,8 +112,8 @@ return function (source) local literals = {} local classes = {} local intValue = true - vm.eachField(source, function (info) - local key, class, literal = getField(info) + vm.eachField(source, function (src) + local key, class, literal = getField(src) classes[key] = vm.mergeTypeViews(class, classes[key]) literals[key] = mergeLiteral(literal, literals[key]) if class ~= 'integer' |