LuaLS / LuaLS/lua-language-server
Feature Request/How-to: Inlined parameter annotation
未關閉
還沒有人認領這個 Issue。
enhancement
- 主要語言
- Lua
- 星號
- 4.4k
- 分支
- 442
- PR 合併指標
- 30 天內沒有已合併 PR
描述
I'd like to be able to do inlined type annotation for parameters. It doesn't currently seem to be possible. What I mean is, instead of this:
---@param key unknown
---@param callbackFn fun(Hook, ...):any
---@param priority? number
---@param hostTableToHook? table
---@param defaultNativeBehavior? function
---@param hookedTableIsMetaTable? boolean
function Hook.basic(key, callbackFn, priority, hostTableToHook, defaultNativeBehavior, hookedTableIsMetaTable)
return Hook.add(key, callbackFn, priority, hostTableToHook, defaultNativeBehavior, hookedTableIsMetaTable, true)
end
I'd like to be able to do this:
function Hook.basic(
key, ---@param unknown
callbackFn, ---@param fun(Hook, ...):any
priority, ---@param? number
hostTableToHook, ---@param? table
defaultNativeBehavior, ---@param? function
hookedTableIsMetaTable ---@param? boolean
)
return Hook.add(key, callbackFn, priority, hostTableToHook, defaultNativeBehavior, hookedTableIsMetaTable, true)
end
This would cut down on the boilerplate a bit and make the code cleaner.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先找出 language server 中處理函式參數與現有內嵌註解的解析邏輯和測試。將這些路徑與本 issue 中的兩個語法範例進行比較;完成的標準是:接受內嵌參數註解,按照範例中的 optional 型別和 function 型別進行解讀,並由測試涵蓋。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- devtools
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100