diff options
Diffstat (limited to 'script/core/hover')
-rw-r--r-- | script/core/hover/init.lua | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/script/core/hover/init.lua b/script/core/hover/init.lua index 80c4db1e..f0315bd8 100644 --- a/script/core/hover/init.lua +++ b/script/core/hover/init.lua @@ -20,6 +20,28 @@ local function eachFunctionAndOverload(value, callback) end end +local function getHoverAsValue(source) + local oop = source.type == 'method' + or source.type == 'getmethod' + or source.type == 'setmethod' + local label = getLabel(source, oop) + local desc = getDesc(source) + if not desc then + local values = vm.getDefs(source, 0) + for _, def in ipairs(values) do + desc = getDesc(def) + if desc then + break + end + end + end + return { + label = label, + source = source, + description = desc, + } +end + local function getHoverAsFunction(source) local values = vm.getDefs(source, 0) local desc = getDesc(source) @@ -59,6 +81,10 @@ local function getHoverAsFunction(source) end end + if defs == 0 then + return getHoverAsValue(source) + end + if defs == 1 and other == 0 then return { label = next(labels), @@ -89,28 +115,6 @@ local function getHoverAsFunction(source) } end -local function getHoverAsValue(source) - local oop = source.type == 'method' - or source.type == 'getmethod' - or source.type == 'setmethod' - local label = getLabel(source, oop) - local desc = getDesc(source) - if not desc then - local values = vm.getDefs(source, 0) - for _, def in ipairs(values) do - desc = getDesc(def) - if desc then - break - end - end - end - return { - label = label, - source = source, - description = desc, - } -end - local function getHoverAsDocName(source) local label = getLabel(source) local desc = getDesc(source) |