LuaLS / LuaLS/lua-language-server
[Feature request] Annotation for referring to superclass
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I'm trying to add annotations to classic, but encounter a few problems when doing so.
For example, the super field refers to the superclass. If I were to annotate super like this
---@class Object
---@field protected super Object
then subclasses will have a super field, but it will always refer to Object, instead of their superclass. The best solution I can come up with the current implementation is to set the super field each time a class is created.
---@class Animal : Object
---@field super Object
local Animal = Object:extend()
---@class Bird : Animal
---@field super Animal
local Bird = Object:extend()
This is a repetition of steps, which tells me DRY. I suggest something like a super annotation, which always refers to the superclass relative to which class it is being used.
---@class Object
---@field protected super super
---@class Animal : Object
local Animal = Object:extend()
-- Animal.super refers to Object
---@class Bird: Object
local Bird = Animal:extend()
-- Bird.super refers to Animal
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issueで参照されているアノテーションの例とclassic.luaの継承モデルを確認します。クラスフィールドのアノテーションがどこで解決されるかを特定し、Object、Animal、Birdに対してスーパークラス相対のアノテーションがどのように動作すべきかを定義します。issueではLuaLSのファイルやテストが指定されていないため、実装前に完了基準を確立する必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100