EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.72k stars 287 forks source link

标记格式与 LDoc 不兼容,无法自动生成文档 #509

Open leaveye opened 1 year ago

leaveye commented 1 year ago

在 IDEA 里查看 lua 脚本时,在符号悬停可以查看文档,但使用 ldoc -f markdown ... 方式生成时就会报错。

遇到不兼容的标签:

leaveye commented 1 year ago

比如文档中的特性:

---- a chain of options
-- @param one
-- @param[opt] two
-- @param[optchain] three
-- @param[optchain] four
function fun (one,two,three,four)
end
----> displayed as: fun (one [, two [, three [, four]]])
--- a function with typed args.
-- If the Lua function has varargs, then
-- you may document an indefinite number of extra arguments!
-- @string name person's name
-- @int age
-- @string[opt='gregorian'] calender optional calendar
-- @int[opt=0] offset optional offset
-- @treturn string
function one (name,age,...)
end
----> displayed as: one (name, age [, calender='gregorian' [, offset=0]])

以及 1.4 版本的实验特性

-----
-- function with return groups.
-- @return[1] result
-- @return[2] nil
-- @return[2] error message
function mul1() ... end

都在上述文档中有提及。

CppCXY commented 1 year ago

ldoc并不是值得兼容的格式(作者写插件的时候并不知道ldoc,后面知道了也不打算改),实际上emmylua doc已经成为事实标准(腾讯开放的几个lua插件都选择支持emmylua doc),而且sumneko_lua(支持一种扩展自emmylua doc的doc)在众多平台的流行(包括neovim,vscode,以及各种使用lsp的平台)。所以支持ldoc也就更没有必要了。当然目前确实也没有相关的生成文档的工具。