LuaLS / LuaLS/lua-language-server
lua-language-server not detecting types when destructuring Tuple types with ~table.unpack~
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Lua
- Estrellas
- 4.4k
- Forks
- 442
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
### How are you using the lua-language-server?
Other
### Which OS are you using?
Windows
### What is the issue affecting?
Diagnostics/Syntax Checking
### Expected Behaviour
I might be wrong here, but I assume this should work?
Language server should detect the types from the defined tuple:
```lua
---@alias my_tuple { [1]: integer, [2]: boolean }
---@type my_tuple
local tuple = {1, true}
--- This works!
local a, b = tuple[1], tuple[2]
--- This gets "integer" for "c", but "unknown" for "d:
local c, d = table.unpack(tuple)
```
### Actual Behaviour
```lua
---@alias my_tuple { [1]: integer, [2]: boolean }
---@type my_tuple
local tuple = {1, true}
--- "c" should be "integer" and "d" "boolean":
local c, d = table.unpack(tuple)
```
### Reproduction steps
1. Define tuple like I did
2. Create such tuple
3. `unpack` to two variables
### Additional Notes
I'm not sure if this is a feature that is even considered, but since I do use unpack sometimes to destructure tuples into their distinct variables, I feel this would be a good feature to have.
### Log File
_No response_
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el problema con el ejemplo de tuple y table.unpack del informe; después, sigue la inferencia de tipos del language server para multiple assignment y unpacked tables. No se nombran archivos de código fuente ni pruebas; se considera terminado cuando el ejemplo infiere c como integer y d como boolean sin hacer retroceder los diagnósticos existentes de tuple.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- lua
- Área
- tooling
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100