summaryrefslogtreecommitdiff
path: root/server/src/core/hover.lua
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/core/hover.lua')
-rw-r--r--server/src/core/hover.lua52
1 files changed, 2 insertions, 50 deletions
diff --git a/server/src/core/hover.lua b/server/src/core/hover.lua
index 627a64f5..ea22f1be 100644
--- a/server/src/core/hover.lua
+++ b/server/src/core/hover.lua
@@ -1,5 +1,6 @@
local findLib = require 'core.find_lib'
local getFunctionHover = require 'core.hover_function'
+local buildValueName = require 'core.hover_name'
local OriginTypes = {
['any'] = true,
@@ -171,55 +172,6 @@ local function buildEnum(lib)
return table.concat(strs)
end
-local function buildValueName(result, source)
- local func = result.value
- local declarat = func.declarat or source
- if declarat then
- local key
- if declarat.type == 'name' then
- key = declarat[1]
- elseif declarat.type == 'string' then
- key = ('%q'):format(declarat[1])
- elseif declarat.type == 'number' or declarat.type == 'boolean' then
- key = tostring(declarat[1])
- elseif func.type == 'function' then
- key = ''
- elseif type(result.key) == 'string' then
- key = result.key
- else
- key = ''
- end
-
- local parentName = declarat.parentName
-
- if not parentName then
- return key or ''
- end
-
- if parentName == '?' then
- local parentType = result.parentValue and result.parentValue.type
- if parentType == 'table' then
- else
- parentName = '*' .. parentType
- end
- end
- if source.object then
- return parentName .. ':' .. key
- else
- if parentName then
- if declarat.index then
- return parentName .. '[' .. key .. ']'
- else
- return parentName .. '.' .. key
- end
- else
- return key
- end
- end
- end
- return result.key or ''
-end
-
local function getFunctionHoverAsLib(name, lib, oo, select)
local args, argLabel = buildLibArgs(lib, oo, select)
local returns = buildLibReturns(lib)
@@ -400,7 +352,7 @@ return function (result, source, lsp, select)
if lib then
hover = getFunctionHoverAsLib(name, lib, oo, select)
else
- hover = getFunctionHover(name, result.value, source, select)
+ hover = getFunctionHover(name, result.value, source.object, select)
end
else
hover = getValueHover(name, valueType, result, source, lib)