summaryrefslogtreecommitdiff
path: root/server/src/core/hover/name.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-03-11 14:52:09 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-03-11 14:52:09 +0800
commit764084f9d2e8f7bb69aea8fc97453f10c9ba7f77 (patch)
treeb1db5b23a9e7569eec21f7df250fd61d0cd7a343 /server/src/core/hover/name.lua
parentf34e6c5ff4ed205881db18049c4a3db542c90b6b (diff)
downloadlua-language-server-764084f9d2e8f7bb69aea8fc97453f10c9ba7f77.zip
更新crossfile
Diffstat (limited to 'server/src/core/hover/name.lua')
-rw-r--r--server/src/core/hover/name.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/src/core/hover/name.lua b/server/src/core/hover/name.lua
index 78c30b4d..4419e4b5 100644
--- a/server/src/core/hover/name.lua
+++ b/server/src/core/hover/name.lua
@@ -11,7 +11,15 @@ return function (source)
declarat = source
end
if not declarat then
- return source:getName() or ''
+ -- 如果声明者没有给名字,则找一个合适的名字
+ local name = value:eachInfo(function (info)
+ if info.type == 'local' or info.type == 'set' or info.type == 'return' then
+ if info.source.type == 'name' and info.source.uri == value.uri then
+ return info.source[1]
+ end
+ end
+ end)
+ return name or ''
end
local key