LuaLS / LuaLS/lua-language-server
Feature: Adding support for custom @tags
未关闭
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
One of the nice things with LDoc was the ability to define custom tags, so they could be used to give additional annotations.
As an example, this is the tags section of one of our projects.
custom_tags = {
{"baseclass", title = "BaseClass", hidden = true},
{"state", title = "State", hidden = true},
{"warns", title = "Warnings", format = function(...)
return "<span class='tag-warning'>" .. markup(...) .. "</span>"
end},
{"bugs", title = "Known Issues", format = function(...)
return "<span class='tag-bugs'>" .. markup(...) .. "</span>"
end},
{"deprecated", title = "Deprecated", format = function(str)
if str == "" then
return "<span class='tag-deprecated'>This function is deprecated and may be removed in a future version.</span>"
else
return "<span class='tag-deprecated'>This function is deprecated and may be removed in a future version.<br>" .. markup(str) .. "</span>"
end
end},
{"internal", title = "Internal", format = function(str)
if str == "" then
return "<span class='tag-internal'>This function is internal. Whilst you can call it, you probably shouldn't.</span>"
else
return "<span class='tag-internal'>This function is internal. Whilst you can call it, you probably shouldn't.<br>" .. markup(str) .. "</span>"
end
end}
}
Even if these aren't used internally, being able to define them for LuaLS to parse and export from the docs exporter in the json document would allow us to do post-processing on the files.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位文档导出器及其生成的 JSON 文档,然后追踪 Lua 注解的解析和导出方式。定义 custom_tags 条目(包括标题、隐藏标志和格式化函数)应如何表示在导出的 JSON 中;当无需内部使用即可解析和后处理自定义标签时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- documentation
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100