LuaLS / LuaLS/lua-language-server

Parser gets confused by stray commas

オープン
#2,564 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
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...

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、2行の代入行を含むLuaの例を再現し、err-equal-as-assignとredundant-valueを生成するparserの経路を調べます。余分なコンマが関連するエラーとして報告され、これらの紛らわしい診断が生成されなければ、この問題は解決されています。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
lua
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。