LuaLS / LuaLS/lua-language-server
Annotations `@enum` and `@enum (key)` in JSON output
還沒有人認領這個 Issue。
- 主要語言
- Lua
- 星號
- 4.4k
- 分支
- 442
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Annotations `@enum` and `@enum (key)` produce very different JSON output.
# Annotation `@enum`
```lua
---@enum level1
---Description of enum level1.
local level1 = {
low = 1, --Low level.
high = 2, --High level.
}
```
This enum creates the following JSON output:
```json
{
"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)`
```lua
---@enum (key) level2
---Description of enum level2.
local level2 = {
low = 1, --Low level.
high = 2, --High level.
}
```
This enum create the following JSON output:
```json
{
"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.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
重現 issue 中帶註解的兩個 enum 範例,並檢查 language server 的註解處理和 JSON 輸出入口。比較 enum 及其項目的原始碼範圍和傳遞的描述。完成的標準是兩種形式都保留 enum 和項目的描述,回報正確的開始/結束值,且輸出結構符合專案預期的行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- devtools
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100