summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorfesily <fesil@foxmail.com>2024-01-10 11:03:21 +0800
committerGitHub <noreply@github.com>2024-01-10 11:03:21 +0800
commit1e7bb72ad3ff2b75a1c55ee4bc53004cb7fe30f7 (patch)
treedd94cf09b9e3a675a73a9f1d41248d1538165997 /tools
parentbb6e172d6166190bd4edd3bb56230a7d60ebcb93 (diff)
parent37779f9b2493e51e59e1e4366bf7dcb8350e69bd (diff)
downloadlua-language-server-1e7bb72ad3ff2b75a1c55ee4bc53004cb7fe30f7.zip
Merge branch 'LuaLS:master' into plugin-add-OnTransformAst
Diffstat (limited to 'tools')
-rw-r--r--tools/build-doc.lua24
1 files changed, 16 insertions, 8 deletions
diff --git a/tools/build-doc.lua b/tools/build-doc.lua
index fbf5fa6b..783a5311 100644
--- a/tools/build-doc.lua
+++ b/tools/build-doc.lua
@@ -53,29 +53,37 @@ local function getDesc(lang, desc)
return locale[id]
end
-local function buildType(md, lang, conf)
- md:add('md', '## type')
+local function view(conf)
if type(conf.type) == 'table' then
- md:add('ts', ('%s | %s'):format(conf.type[1], conf.type[2]))
+ local subViews = {}
+ for i = 1, #conf.type do
+ subViews[i] = conf.type[i]
+ end
+ return table.concat(subViews, ' | ')
elseif conf.type == 'array' then
- md:add('ts', ('Array<%s>'):format(conf.items.type))
+ return ('Array<%s>'):format(view(conf.items))
elseif conf.type == 'object' then
if conf.properties then
local _, first = next(conf.properties)
assert(first)
- md:add('ts', ('object<string, %s>'):format(first.type))
+ return ('object<string, %s>'):format(view(first))
elseif conf.patternProperties then
local _, first = next(conf.patternProperties)
assert(first)
- md:add('ts', ('Object<string, %s>'):format(first.type))
+ return ('Object<string, %s>'):format(view(first))
else
- md:add('ts', '**Unknown object type!!**')
+ return '**Unknown object type!!**'
end
else
- md:add('ts', ('%s'):format(conf.type))
+ return tostring(conf.type)
end
end
+local function buildType(md, lang, conf)
+ md:add('md', '## type')
+ md:add('ts', view(conf))
+end
+
local function buildDesc(md, lang, conf)
local desc = conf.markdownDescription or conf.description
desc = getDesc(lang, desc)