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