LuaLS / LuaLS/lua-language-server
Two Rule Suggestions: multiple returns in function calls / table definitions and string concatenation
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
### multiple returns in function calls / table definitions
```lua
local a = { "one", "two", "three" }
local b = { unpack(a), "four" }
local c = { "four", unpack(a) }
print(#b) -- 2
print(#c) -- 4
```
`unpack`'s behavior is quite unintuitive; when the output is not in the last position of a table definition, only the first element is actually included in the new table. (In fact, this not only applies to `unpack`, but to every function that returns multiple values – only happens most often with `unpack` that will people will notice, I assume.)
see explainer in the docs: https://www.lua.org/manual/5.3/manual.html#3.4
I think a diagnostic that reminds one of such cases would be very useful, since it's a common gotcha in lua.
## string concatenation
```lua
print("foo" + "bar")
```
Common mistake to not use `..` for string concatenation. Even though I am used to lua, it still happens to me all the time after coming back from writing in a different language. A diagnostic here would be useful. (And I am actually a bit surprised that there isn't one yet.)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Issue でリンクされている Lua 5.3 マニュアルのセクションから始め、特にテーブルの例で示されている複数戻り値の規則を確認します。次に、テーブル定義内の複数戻り値式と、文字列に対する + の使用に関する language server の診断エントリポイントを見つけます。両方の例で有用な診断が生成され、妥当な Lua コードが誤って指摘されなければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100