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