LuaLS / LuaLS/lua-language-server
Feature Request: Hide a parameter from the annotation
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
I have a table with a metatable assigned to it to implement inheritance. The metatable's `__index` metamethod intercepts a call to a function on the original table and gets the actual function from the "parent" table and then injects another parameter into the function call.
For example, the user would call the function like this: `tbl:Execute("hello", "world")` and the function would be implemented like this:
```lua
function ParentTable:Execute(data, hello, world)
-- data is a special parameter controlled by the metatable and is given a table value
-- hello is assigned "hello" and world is assigned "world"
end
```
The problem with this is that VS Code and LuaLS warns the user that they didn't provide a value to `data`. I have to use `@overload` to every single method to say you can call this method with just "hello" and "world" arguments provided.
I want to be able to tell LuaLS to completely hide/ignore the `data` parameter and pretend it doesn't exist; essentially moving all other parameter indexes down by 1 to fill the empty spot, so "hello" is recognized as parameter 1 and "world" as parameter 2.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先追踪 LuaLS 如何处理函数参数注解、@overload 声明,以及通过元表的 __index 元方法拦截的调用。完成的标准是:LuaLS 能够隐藏注入的数据参数,调整可见参数的位置,并在调用方只提供 hello 和 world 时停止发出警告。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100