summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-10 11:48:57 +0800
committersumneko <sumneko@hotmail.com>2019-04-10 11:48:57 +0800
commit410b793917881bc7309b9db1836135a97ffcce11 (patch)
tree85111c72f7b14d633f91c9d280a919b8e84b6863 /server/src
parent3b27e1eadae8c56b98d6f52985aee7e9d952eb56 (diff)
downloadlua-language-server-410b793917881bc7309b9db1836135a97ffcce11.zip
修改重命名基础库后的hover显示
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/find_lib.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/server/src/core/find_lib.lua b/server/src/core/find_lib.lua
index 3ba7865f..e76549a8 100644
--- a/server/src/core/find_lib.lua
+++ b/server/src/core/find_lib.lua
@@ -1,3 +1,5 @@
+local hoverName = require 'core.hover.name'
+
local function getParentName(lib, isObject)
for _, parent in ipairs(lib.parent) do
if isObject then
@@ -37,8 +39,15 @@ local function findLib(source)
end
end
else
- local name = lib.nick or lib.name
- return lib, name
+ local name = hoverName(source)
+ local libName = lib.nick or lib.name
+ if name == libName or not libName then
+ return lib, name
+ elseif name == '' then
+ return lib, libName
+ else
+ return lib, ('%s<%s>'):format(name, libName)
+ end
end
end