LuaLS / LuaLS/lua-language-server
enum inherits fields from class with different name
未关闭
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Annotations
Expected Behaviour
As far as enum has unique name, this warning should not exist.
Actual Behaviour
Here is my annotations:
-- RenderMode.Regular, path: ['viewscreen_titlest', 'menu_line_id'], container
---@class viewscreen_titlest.menu_line_id_C
---@field [integer] viewscreen_titlest.menu_line_id
---@field resize fun(self: self, size: integer): nil
---@field insert fun(self: self, index: "#"|integer, item: viewscreen_titlest.menu_line_id): nil
---@field erase fun(self: self, index: integer): nil
---@field assign fun(self: self, obj: self): nil
---@field delete fun(self: self): boolean
---@field _displace fun(self: self, index: integer): self
---@field _kind "primitive"|"struct"|"container"|"bitfield"
---@field _type table | string
df.viewscreen_titlest.menu_line_id_C = nil
-- RenderMode.Regular, path: ['viewscreen_titlest', 'menu_line_id'], enum
---@enum viewscreen_titlest.menu_line_id
df.viewscreen_titlest.menu_line_id = {
Continue = 0,
Start = 1,
NewWorld = 2,
TestingArena = 3, -- nonfunctional in 50.04
Mods = 4, -- nonfunctional in 50.04 since v50.01
Settings = 5,
AboutDF = 6,
Quit = 7,
}
As you can see, there are different typenames and objects names.
But enum requires class fields.
Missing required fields in type `viewscreen_titlest.menu_line_id_C`: `resize`, `insert`, `erase`, `assign`, `delete`, `_displace`, `_kind`, `_type`
Reproduction steps
Get code above and check.
Additional Notes
No response
Log File
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中带注释的复现开始,跟踪 language server 在类型名称和对象名称不同时如何解析 @enum 和 @class 声明。验证报告类字段缺失的诊断,然后确认对于这个独立的 enum 不会出现警告,同时真正的必填字段检查仍然保持不变。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100