summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCppCXY <812125110@qq.com>2024-02-22 20:29:13 +0800
committerCppCXY <812125110@qq.com>2024-02-22 20:29:13 +0800
commit9b6df71d97a70ee7179949ef9f15368cbf29dcbd (patch)
treebf7a7e62ed7c164a12bdce437c17262a5235bcec /tools
parent483fe246b6ae8c25d433aa15e43f04f0e71a74d5 (diff)
parent3e6fd3ce1f2f0528336ded939d776a29bbfaf2eb (diff)
downloadlua-language-server-9b6df71d97a70ee7179949ef9f15368cbf29dcbd.zip
Merge branch 'master' of github.com:CppCXY/lua-language-server
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)