LuaLS / LuaLS/lua-language-server
[Feature Request] @mixin - @class specific syntax to define applied mixins
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
What
A way to indicate that the members of a @class type are applied to a subject @class outside of the inheritance chain
Technical
@mixin type, ...
Adds the values of type, ... to the subject class' definition. Mixins are applied in the order they are specified; values of the same key are overwrote as each mixin is processed
Example
This:
---@class Mixin1
---@field foo number
---@field bar number
---@class Mixin2
---@field bar string
---@field baz string
---@class Subject
---@field key boolean
---@field foo boolean
---@mixin Mixin1, Mixin2
Would get interpreted as
---@class Subject
---@field key boolean (defined by field; wasn't altered by mixins)
---@field foo number (defined by field, overwrote by mixin1, not overwrite by mixin2)
---@field bar string (defined by mixin1, overwrite by mixin2)
---@field baz string (defined by mixin2)
Use case
I currently have sub-classes that get assigned valves from reusable dictionary tables outside their inheritance chain. The only way to document those modifications is to statically define the fields each time a mixin is applied
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
ファイルやテストは指定されていません。まず、language server が既存の @class アノテーションと継承をどのように解析しているかを追跡し、次に、順序付けられた @mixin の適用とフィールドの上書きをどこに組み込めるかを判断してください。完了の条件は、指定された優先順位ルールで構文が解析され、複数の mixin と衝突に対するテストでカバーされていることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100