diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-21 20:06:20 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-21 20:06:20 +0800 |
commit | bafe0e44914ad3b669388b94b91d9992edeb8e07 (patch) | |
tree | 26f78a3934dc38d31f82bbf9b33975dfecb3a0d8 /server-beta/src/core/hover/arg.lua | |
parent | c354b5e8bd05ba117857ac93e8d647980875d98d (diff) | |
download | lua-language-server-bafe0e44914ad3b669388b94b91d9992edeb8e07.zip |
hover的第一步
Diffstat (limited to 'server-beta/src/core/hover/arg.lua')
-rw-r--r-- | server-beta/src/core/hover/arg.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/server-beta/src/core/hover/arg.lua b/server-beta/src/core/hover/arg.lua new file mode 100644 index 00000000..be344488 --- /dev/null +++ b/server-beta/src/core/hover/arg.lua @@ -0,0 +1,20 @@ +local guide = require 'parser.guide' +local vm = require 'vm' + +local function asFunction(source) + if not source.args then + return '' + end + local args = {} + for i = 1, #source.args do + local arg = source.args[i] + args[i] = ('%s: %s'):format(guide.getName(arg), vm.getType(arg)) + end + return table.concat(args, ', ') +end + +return function (source) + if source.type == 'function' then + return asFunction(source) + end +end |