LuaLS / LuaLS/lua-language-server
[Feature Request] ---@final to mark class method as non-overridable
還沒有人認領這個 Issue。
- 主要語言
- Lua
- 星號
- 4.4k
- 分支
- 442
- PR 合併指標
- 30 天內沒有已合併 PR
描述
In languages like Java, you have the keyword final to indicate that a function should NOT be overridden. There doesn't seem to be any annotation like that yet. It should give a warning (or error?) if you try to override the function. Additionally, completion for function MyClass: could avoid suggesting anything with @final? You'd still be able to call it anywhere, just not override it if its now final.
(Maybe @final could also work on variables? Pretty much working the same way, just "don't override/set this but still be able to read it")
(Unrelated but I was thinking about ---@override to mark something as "you should override this and not call this" but it wouldn't be able to warn since your internal code needs to call it, so I'm not sure. Might just be good to have anyway, not as a warning but a tooltip thing.)
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
未指定原始檔、測試或進入點。首先釐清 @final 是套用於方法、變數,還是兩者,以及違規會產生警告還是錯誤;然後檢查語言伺服器的註解、覆寫檢查和補全行為。當選定的語意獲得一致實作,並由診斷或補全測試涵蓋時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- devtools
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100