LuaLS / LuaLS/lua-language-server
Bug with incorrectly reporting undefined-global
Personne n'a encore pris cette issue.
- Langage dominant
- Lua
- Étoiles
- 4.4k
- Forks
- 442
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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')
```
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Reproduisez le problème dans le dépôt WeakAuras avec l’extension VSCode et les paramètres d’espace de travail signalés. Commencez par script/core/diagnostics/param-type-mismatch.lua à la ligne 21 et suivez la pile à travers script/provider/diagnostic.lua ; le travail est terminé lorsque l’indexation des diagnostics ne provoque plus de plantage et que les rapports concernant les variables globales non définies restent corrects après la réindexation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- lua
- Domaine
- devtools
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100