Replies: 1 comment
-
The meaning of The top level object always has one of two types:
Within the Finally within the extends array the type is the actual Lua type (or user defined type alias). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Dear luaLS team:
I'm very glad our team choose LuaLS as our project annotation usage. Recently we also want to generate lua api documents, we follow the instruct as showed in this url. And we choose JSON as our custom document input. But we met a problem that we cannot identify the meaning of each field in the json file, below is an example:
lua code:
`---@Class TestModule
local M = {}
---@Class MyUserInfo
---@field public account string 账号
---@field public tel string 电话
---@field public age number 年龄
---测试function描述
---@param name string 名称
---@param value? MyUserInfo 用户信息
---@return boolean|nil, number, string
function M.test_fun(name, value)
return true, 0, ""
end
local function main()
M.test_fun("asdf")
end
return M`
the json file is below:
{ "defines": [ { "file": "file:///Users/ali_1/Downloads/test_lua/./test.lua", "finish": 90020, "start": 90010, "type": "doc.class" } ], "fields": [ { "desc": "账号", "extends": { "finish": 100031, "start": 100025, "type": "doc.type", "types": [ { "finish": 100031, "start": 100025, "type": "doc.type.name", "view": "string" } ], "view": "string" }, "file": "file:///Users/ali_1/Downloads/test_lua/./test.lua", "finish": 100031, "name": "account", "rawdesc": "账号", "start": 100010, "type": "doc.field" }, { "desc": "年龄", "extends": { "finish": 120027, "start": 120021, "type": "doc.type", "types": [ { "finish": 120027, "start": 120021, "type": "doc.type.name", "view": "number" } ], "view": "number" }, "file": "file:///Users/ali_1/Downloads/test_lua/./test.lua", "finish": 120027, "name": "age", "rawdesc": "年龄", "start": 120010, "type": "doc.field" }, { "desc": "电话", "extends": { "finish": 110027, "start": 110021, "type": "doc.type", "types": [ { "finish": 110027, "start": 110021, "type": "doc.type.name", "view": "string" } ], "view": "string" }, "file": "file:///Users/ali_1/Downloads/test_lua/./test.lua", "finish": 110027, "name": "tel", "rawdesc": "电话", "start": 110010, "type": "doc.field" } ], "name": "MyUserInfo", "type": "type" }, { "defines": [ { "file": "file:///Users/ali_1/Downloads/test_lua/./test.lua", "finish": 60020, "start": 60010, "type": "doc.class" } ], "desc": "\n Generated by EmmyLua(https://github.com/EmmyLua)\n Created by sminsss.\n DateTime: 2018/8/24 下午10:59\n", "fields": [ { "desc": "测试function描述\n\n@*param*
name— 名称\n\n@*param*
value— 用户信息", "extends": { "args": [ { "desc": "名称", "finish": 180024, "name": "name", "rawdesc": "名称", "start": 180020, "type": "local", "view": "string" }, { "desc": "用户信息", "finish": 180031, "name": "value", "rawdesc": "用户信息", "start": 180026, "type": "local", "view": "MyUserInfo?" } ], "desc": "测试function描述\n\n@*param*
name— 名称\n\n@*param*
value— 用户信息", "finish": 200003, "rawdesc": "测试function描述", "returns": [ { "type": "function.return", "view": "boolean|nil" }, { "type": "function.return", "view": "number" }, { "type": "function.return", "view": "string" } ], "start": 180000, "type": "function", "view": "function TestModule.test_fun(name: string, value?: MyUserInfo)\n -> boolean|nil\n 2. number\n 3. string" }, "file": "file:///Users/ali_1/Downloads/test_lua/./test.lua", "finish": 180019, "name": "test_fun", "rawdesc": "测试function描述", "start": 180009, "type": "setfield" } ], "name": "TestModule", "rawdesc": "\n Generated by EmmyLua(https://github.com/EmmyLua)\n Created by sminsss.\n DateTime: 2018/8/24 下午10:59\n", "type": "type" }
my question is:
Thanks
Beta Was this translation helpful? Give feedback.
All reactions