LuaLS / LuaLS/lua-language-server

Annotations `@enum` and `@enum (key)` in JSON output

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

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

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

説明

Annotations @enum and @enum (key) produce very different JSON output.

Annotation @enum

---@enum level1
---Description of enum level1.
local level1 = {
   low = 1, --Low level.
   high = 2, --High level.
}

This enum creates the following JSON output:

    {
        "defines": [
            {
                "file": "file:///home/andreas/Projects/Code/luals2dox/test/./enum/enum-02.lua",
                "finish": 15,
                "start": 9,
                "type": "doc.enum"
            }
        ],
        "desc": "```lua\n{\n    low: integer = 1,\n    high: integer = 2,\n}\n```",
        "fields": [],
        "name": "level1",
        "rawdesc": "```lua\n{\n    low: integer = 1,\n    high: integer = 2,\n}\n```",
        "type": "type"
    },
    {
        "defines": [
            {
                "file": "file:///home/andreas/Projects/Code/luals2dox/test/./enum/enum-02.lua",
                "finish": 40007,
                "start": 40003,
                "type": "tablefield"
            }
        ],
        "desc": "High level.",
        "fields": [],
        "name": "level1.high",
        "rawdesc": "High level.",
        "type": "type"
    },
    {
        "defines": [
            {
                "file": "file:///home/andreas/Projects/Code/luals2dox/test/./enum/enum-02.lua",
                "finish": 30006,
                "start": 30003,
                "type": "tablefield"
            }
        ],
        "desc": "Low level.",
        "fields": [],
        "name": "level1.low",
        "rawdesc": "Low level.",
        "type": "type"
    },

Issues:

  • First block: start and finish numbers are wrong.
  • Description of enum Description of enum level1. is missing.

Just curious:

  • Why are there 3 separate blocks for this enum? I'd expected block 2 and 3 (enum items) to be sub-blocks of block 1 (enum). This would make it easier reading/postprocessing the JSON file.

Annotation @enum (key)

---@enum (key) level2
---Description of enum level2.
local level2 = {
   low = 1, --Low level.
   high = 2, --High level.
}

This enum create the following JSON output:

   {
        "defines": [
            {
                "file": "file:///home/andreas/Projects/Code/luals2dox/test/./enum/enum-02.lua",
                "finish": 70021,
                "start": 70015,
                "type": "doc.enum"
            }
        ],
        "desc": "```lua\n\"low\" | \"high\"\n```",
        "fields": [],
        "name": "level2",
        "rawdesc": "```lua\n\"low\" | \"high\"\n```",
        "type": "type"
    },

Issues:

  • Description of enum Description of enum level2. is missing.
  • Description of enum items Low level. and High level. are missing.

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

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

はじめの一歩

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

調査の方向性

issue にある注釈付き enum の 2 つの例を再現し、アノテーション処理と JSON 出力における language server のエントリーポイントを調べます。enum とその項目について、ソース範囲と伝播された説明を比較します。両方の形式で enum と項目の説明が保持され、正しい開始値と終了値が報告され、出力構造がプロジェクトの意図した動作と一致すれば完了です。

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

評価

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

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

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