summaryrefslogtreecommitdiff
path: root/server/src/core/hover.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-05 14:28:09 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-05 14:28:09 +0800
commite5131f6964d22e26cfcc6075e547666452df699c (patch)
treea5f14c0fa5384a3495d73657a322991a44508d37 /server/src/core/hover.lua
parent750dc445ea6f0d9010b73f9a8b884e6ca55dfb26 (diff)
downloadlua-language-server-e5131f6964d22e26cfcc6075e547666452df699c.zip
局部函数的hover
Diffstat (limited to 'server/src/core/hover.lua')
-rw-r--r--server/src/core/hover.lua31
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