LuaLS / LuaLS/lua-language-server

Request: Support `@field` in both enum and table definitions.

オープン
#2,960 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Lua
スター
4.4k
フォーク
442
PR マージ指標
30日以内にマージされた PR はありません

説明

Request: Allow adding a field type to tables and enum definitions using the @field annotation.

This is useful for generating meta files from C code where there is no Lua table literal to copy.

See current behaviour below:

@class

✅ Using @field
---@class Foo
---@field myField 5
Foo = {}
✅ Using literal code
---@class Foo
Foo = {
  myField = 5,
}
✅ Using type annotation
---@class Foo
Foo = {
  ---@type 5
  myField = nil,
}

@enum

❌ Using field
---@enum Foo
---@field myField 5
Foo = {}

Error: The field must be defined after the class.Lua Diagnostics.(doc-field-no-class)

✅ Using literal code
---@enum Foo
Foo = {
  myField = 5,
}
✅ Using type annotation
---@enum Foo
Foo = {
  ---@type 5
  myField = nil,
}

Untyped table

❌ Using field
---@field myField 5
Foo = {}

Error: The field must be defined after the class.Lua Diagnostics.(doc-field-no-class)

✅ Using literal code
Foo = {
  myField = 5,
}
✅ Using type annotation
Foo = {
  ---@type 5
  myField = nil,
}

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、診断 doc-field-no-class に関連する @field の処理を追跡してください。この issue には @class、@enum、型指定のないテーブルの Lua の例があります。完了とは、既存のクラスの動作を引き続きサポートしつつ、例のような enum 定義およびテーブル定義で @field 定義がその診断なしに機能することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
lua
領域
devtools
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。