LuaLS / LuaLS/lua-language-server
Feature request: Infer overload annotations for subsequent overloads
未关闭
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
It would be useful for subsequent function overload definitions to use prior annotations unless a new annotation is provided.
Such as:
---An example function
---@param a integer
---@param b string
---@param c function Some documentation about c
---@return boolean
---@overload fun(c)
---@overload fun(a): nil
function foo(a, b, c) end
being equivalent to
---An example function
---@param a integer
---@param b string
---@param c function Some documentation about c
---@return boolean
function foo(a, b, c) end
---An example function
---@param c function Some documentation about c
---@return boolean
function foo(c)
---An example function
---@param a integer
---@return nil
function foo(a)
With auto-generated documentation this isn't so much of a problem, but it's a bit of a chore when it's something to be done by hand.
Appreciate all the work you've done! This makes writing Lua so much more confident.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
issue 中没有指定文件或测试。首先定位 @overload 以及参数/返回值注解的处理位置,然后为继承之前的注解,以及在 overload 提供新注解时覆盖之前的注解,添加有针对性的覆盖。完成的标准是:示例中的两个 overload 获得文档所述的继承注解和显式注解,同时不改变原始定义。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100