summaryrefslogtreecommitdiff
path: root/script-beta/core
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-11-29 16:38:07 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-11-29 16:38:07 +0800
commit155ee2059dd18d805140b87901d01ff79257ed60 (patch)
tree26b80a361a112170970cffcb84c3594330461db1 /script-beta/core
parenta64957132d5c9ecf6c66003ff028d68772d1aa1f (diff)
downloadlua-language-server-155ee2059dd18d805140b87901d01ff79257ed60.zip
支持部分library
Diffstat (limited to 'script-beta/core')
-rw-r--r--script-beta/core/hover/arg.lua7
-rw-r--r--script-beta/core/hover/label.lua7
-rw-r--r--script-beta/core/hover/name.lua6
3 files changed, 19 insertions, 1 deletions
diff --git a/script-beta/core/hover/arg.lua b/script-beta/core/hover/arg.lua
index be344488..70285e6b 100644
--- a/script-beta/core/hover/arg.lua
+++ b/script-beta/core/hover/arg.lua
@@ -8,7 +8,12 @@ local function asFunction(source)
local args = {}
for i = 1, #source.args do
local arg = source.args[i]
- args[i] = ('%s: %s'):format(guide.getName(arg), vm.getType(arg))
+ local name = arg.name or guide.getName(arg)
+ if name then
+ args[i] = ('%s: %s'):format(name, vm.getType(arg))
+ else
+ args[i] = ('%s'):format(vm.getType(arg))
+ end
end
return table.concat(args, ', ')
end
diff --git a/script-beta/core/hover/label.lua b/script-beta/core/hover/label.lua
index 765b01c2..f5d49bb0 100644
--- a/script-beta/core/hover/label.lua
+++ b/script-beta/core/hover/label.lua
@@ -82,6 +82,13 @@ local function asField(source)
return asValue(source, 'field')
end
+local function asLibrary(source)
+ local lib = source.library
+ if lib.type == 'function' then
+ return asFunction(source)
+ end
+end
+
return function (source)
if source.type == 'function' then
return asFunction(source)
diff --git a/script-beta/core/hover/name.lua b/script-beta/core/hover/name.lua
index b96a8169..83c750c3 100644
--- a/script-beta/core/hover/name.lua
+++ b/script-beta/core/hover/name.lua
@@ -28,6 +28,12 @@ local function asGlobal(source)
end
local function buildName(source)
+ if source.doc then
+ return source.doc
+ end
+ if source.name then
+ return source.name
+ end
if source.type == 'local'
or source.type == 'getlocal'
or source.type == 'setlocal' then