LuaLS / LuaLS/lua-language-server
enum inherits fields from class with different name
オープン
まだ誰も着手していません。
- 主要言語
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
issue にある注釈付きの再現例から始め、型名とオブジェクト名が異なる場合に language server が @enum と @class の宣言をどのように解決するかを追跡します。クラスフィールドが不足していると報告する診断を検証し、そのうえで、この独立した enum では警告が表示されない一方、実際に必要なフィールドのチェックは引き続き維持されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100