LuaLS / LuaLS/lua-language-server
Parser gets confused by stray commas
还没有人认领这个 Issue。
- 主要语言
- Lua
- 星标
- 4.4k
- 派生
- 442
- PR 合并指标
- 30 天内没有已合并 PR
描述
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...
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先复现包含两条赋值语句的 Lua 示例,并检查生成 err-equal-as-assign 和 redundant-value 的 parser 路径。当多余的逗号被报告为相关错误,而不是产生这些令人困惑的诊断时,该问题就得到了解决。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- lua
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100