LuaLS / LuaLS/lua-language-server
Multiple return values for fields
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Annotations
Expected Behaviour
The ability to define multiple return values for a field annotation.
Actual Behaviour
Any non-identifier symbol following a type is treated as a comment or a break.
Reproduction steps
- Create a field with a comma separated return type.
- See that anything following the comma is treated as a comment.
Additional Notes
---@class Color
---@field [string] Color,string
Color = {}
,string is highlighted as a comment.
---@class Color
---@field [string] Color, string
Color = {}
, is highlighted as a symbol, string is highlighted as a comment.
An example of fields with multiple return types are the named color lookups in the Tabletop Simulator API:
https://api.tabletopsimulator.com/color/#colorblue
local color, name = Color.Blue
print(color) -- Color: Blue { r = 0.118, g = 0.53, b = 1, a = 1 }
print(name) -- Blue
local color, name = Color.Red
print(color) -- Color: Red { r = 0.856, g = 0.1, b = 0.094, a = 1 }
print(name) -- Red
Log File
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Verhalten des Annotation-Parsers anhand der bereitgestellten Lua-Snippets zu reproduzieren, wobei du dich darauf konzentrierst, wie durch Kommas getrennte Typen nach einer @field-Deklaration tokenisiert werden. Als erledigt gilt dies, wenn mehrere Rückgabetypen wie Color,string als Annotation-Typen erkannt werden, anstatt den Rest als Kommentar zu behandeln; füge Tests hinzu oder aktualisiere die Abdeckung, falls das Repository relevante Parser-Tests enthält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100