LuaLS / LuaLS/lua-language-server

Bug with incorrectly reporting undefined-global

Abierto
#1,702 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Info Needed
Lenguaje dominante
Lua
Estrellas
4.4k
Forks
442
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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')
```

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Reproduce el problema en el repositorio de WeakAuras con la extensión de VSCode y la configuración del workspace indicada. Empieza en script/core/diagnostics/param-type-mismatch.lua, en la línea 21, y sigue la pila a través de script/provider/diagnostic.lua; el trabajo estará terminado cuando la indexación de diagnósticos ya no provoque un fallo y los informes de variables globales indefinidas sigan siendo correctos después de volver a indexar.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
lua
Área
devtools
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.