LuaLS / LuaLS/lua-language-server
Bug with incorrectly reporting undefined-global
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
So I have this very strange bug where the VSCode extension starts reporting undefined-globals but when I click on the actual problem report, it goes away.
These globals are defined in a file that is loaded as a library via an [extension](https://github.com/Ketho/vscode-wow-api) so I figured I might reach the max workspace files/size limit but even with those set to very high numbers it keeps happening. I can click on all of them to make them go away but the next indexing run (hitting save) will bring them back.
`workspace.maxPreload` is set to `20000`
`workspace.preloadFileSize` is set to `8000`
The repo I tested with is [WeakAuras](https://github.com/WeakAuras/WeakAuras2)
https://user-images.githubusercontent.com/75278/202040021-d15fda8e-85ce-4055-a39e-d9538f6b5446.mp4
So my next guess was that the LSP just crashes and restarts, I checked the output panel and got this:
```
script/core/diagnostics/param-type-mismatch.lua:21: attempt to index a nil value (field 'generic')
stack traceback:
script/core/diagnostics/param-type-mismatch.lua:21: in upvalue 'expandGenerics'
script/core/diagnostics/param-type-mismatch.lua:48: in upvalue 'getDefNode'
script/core/diagnostics/param-type-mismatch.lua:97: in local 'callback'
script/parser/guide.lua:716: in function 'parser.guide.eachSourceType'
script/core/diagnostics/param-type-mismatch.lua:83: in function 'core.diagnostics.param-type-mismatch'
script/core/diagnostics/init.lua:117: in upvalue 'check'
script/core/diagnostics/init.lua:174: in function 'core.diagnostics'
[C]: in function 'xpcall'
script/provider/diagnostic.lua:324: in function 'provider.diagnostic.doDiagnostic'
[C]: in function 'xpcall'
script/provider/diagnostic.lua:665: in upvalue 'callback'
script/files.lua:880: in function
script/core/diagnostics/param-type-mismatch.lua:21: attempt to index a nil value (field 'generic')
```
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
VSCode拡張機能と報告されたワークスペース設定を使って、WeakAurasリポジトリで問題を再現します。script/core/diagnostics/param-type-mismatch.lua の21行目から始め、script/provider/diagnostic.lua を通るスタックを追跡します。診断のインデックス作成でクラッシュが発生しなくなり、再インデックス後も未定義のグローバルに関する報告が正しいままであれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100