LuaLS / LuaLS/lua-language-server
Annotations `@enum` and `@enum (key)` in JSON output
Nessuno ha ancora preso questa issue.
- Lingua principale
- Lua
- Stelle
- 4.4k
- Fork
- 442
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci i due esempi di enum annotati dell'issue e ispeziona i punti di ingresso del language server per l'elaborazione delle annotazioni e l'output JSON. Confronta gli intervalli del sorgente e le descrizioni propagate per l'enum e i suoi elementi. Il lavoro è completato quando entrambe le forme preservano le descrizioni dell'enum e degli elementi, riportano valori di inizio/fine corretti e la struttura dell'output corrisponde al comportamento previsto dal progetto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- lua
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100