LuaLS / LuaLS/lua-language-server
Parser gets confused by stray commas
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
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...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Lua example with the two assignment lines and inspect the parser path that produces err-equal-as-assign and redundant-value. The issue is addressed when the stray comma is reported as the relevant error rather than producing those confusing diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100