LuaLS / LuaLS/lua-language-server
Parser gets confused by stray commas
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Example:
L.FOO = "something",
L.BAR = "something else"
This triggers two unexpected diagnostics: err-equal-as-assign and redundant-value which is a bit confusing.
The reason is that it interprets this as that the user's intent was to write FOO, (some other var) = "something", BAR == "something else"
However, the actual error is a stray comma after the first line.
This error may sound a bit obscure, because why would add someone a stray comma? The answer is that this happened in a localization files where people who are not necessarily familiar with Lua are contributing translations. Sometimes these translations are given in table literals where they need to add commas after each line and sometimes they are given as a list of setfield statements...
This is probably not easy to fix because the parser's interpretation is completely valid until it encounteres the assignment...
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 Lua-Beispiel mit den beiden Zuweisungszeilen zu reproduzieren, und untersuche den Parser-Pfad, der err-equal-as-assign und redundant-value erzeugt. Das Problem ist behoben, wenn das überflüssige Komma als relevanter Fehler gemeldet wird, statt diese verwirrenden Diagnosen zu erzeugen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- compilers
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100