LuaLS / LuaLS/lua-language-server
Register function environment variables
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
This extension is able to detect usage of undefined global variables:

However, `setfenv` is used on this function to define the missing variable, but at another point in the code that the parser can't detect. Is it possible to somehow tell the parser to ignore this diagnostic? Something like:
```lua
local block = function(_)
-- env: {block, assert, error}
block()
end
```
Then it would accept those values? I know you can define globals for the project, but this doesn't affect the entire project, only those functions, so it would be cool if you could define it somehow.
Alternatively, could we just disable the diagnostic?
```lua
local block = function(_)
-- disable: undefined-global
block()
end
```
I don't know if the parser supports reading comments like that, let me know if that won't work or if you have better ideas for it.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、parser の未定義グローバル診断を追跡し、プロジェクトレベルのグローバル定義をどのように読み取るかを調べます。次に、issue で提案されている関数ローカル環境のアノテーションと診断を無効化するコメントを評価し、選択した構文が意図した関数スコープの警告だけを抑制または解決することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100