summaryrefslogtreecommitdiff
path: root/server-beta/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'server-beta/src/core')
-rw-r--r--server-beta/src/core/hover/name.lua23
1 files changed, 21 insertions, 2 deletions
diff --git a/server-beta/src/core/hover/name.lua b/server-beta/src/core/hover/name.lua
index d0caf885..ef7fee02 100644
--- a/server-beta/src/core/hover/name.lua
+++ b/server-beta/src/core/hover/name.lua
@@ -1,5 +1,21 @@
+local guide = require 'parser.guide'
+local vm = require 'vm'
+
local function asLocal(source)
- return source[1]
+ return guide.getName(source)
+end
+
+local function asMethod(source)
+ local class = vm.eachField(source.node, function (info)
+ if info.key == 's|type' or info.key == 's|__name' then
+ if info.value and info.value.type == 'string' then
+ return info.value[1]
+ end
+ end
+ end)
+ local node = class or guide.getName(source.node) or '*'
+ local method = guide.getName(source)
+ return ('%s:%s'):format(node, method)
end
return function (source)
@@ -10,7 +26,10 @@ return function (source)
if parent.type == 'local'
or parent.type == 'getlocal'
or parent.type == 'setlocal' then
- return asLocal(parent)
+ return asLocal(parent) or ''
+ end
+ if parent.type == 'setmethod' then
+ return asMethod(parent) or ''
end
return ''
end