diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-03-05 14:28:09 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-03-05 14:28:09 +0800 |
commit | e5131f6964d22e26cfcc6075e547666452df699c (patch) | |
tree | a5f14c0fa5384a3495d73657a322991a44508d37 /server/src/core/hover.lua | |
parent | 750dc445ea6f0d9010b73f9a8b884e6ca55dfb26 (diff) | |
download | lua-language-server-e5131f6964d22e26cfcc6075e547666452df699c.zip |
局部函数的hover
Diffstat (limited to 'server/src/core/hover.lua')
-rw-r--r-- | server/src/core/hover.lua | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/server/src/core/hover.lua b/server/src/core/hover.lua index 120d65f5..06e95379 100644 --- a/server/src/core/hover.lua +++ b/server/src/core/hover.lua @@ -352,10 +352,25 @@ local function getStringHover(result, lsp) } end -local function hoverAsValue(result, source, lsp, select) - if result:getType() == 'string' then - return getStringHover(result, lsp) +local function hoverAsValue(source, lsp, select) + local lib, fullkey, isObject = findLib(source) + local value = source:bindValue() + local name = fullkey or buildValueName(source) + + local hover + if value:getType() == 'function' then + if lib then + else + hover = getFunctionHover(name, value:getFunction(), source:getFlag 'object', select) + end + else end + + if not hover then + return nil + end + hover.name = name + return hover end local function hoverAsVar(result, source, lsp, select) @@ -399,13 +414,11 @@ local function hoverAsVar(result, source, lsp, select) return hover end -return function (result, source, lsp, select) - if not result then +return function (source, lsp, select) + if not source then return nil end - if result.type == 'value' then - return hoverAsValue(result, source, lsp, select) - else - return hoverAsVar(result, source, lsp, select) + if source:bindValue() then + return hoverAsValue(source, lsp, select) end end |