LuaLS / LuaLS/lua-language-server
Class definitions get confused with same filenames across folders.
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?
Visual Studio Code Extension (sumneko.lua)
Which OS are you using?
Windows
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
I have two files, both named the same but in different paths. Each file has its own class and table structure name, which differs from each other.
class A doesn't have method "MyMethod"
class B does
When creating an instance of the class B, and using MyMethod from class B it says that Class A has undefined field "MyMethod" despite being an instance of class B
Renaming class B's file name to something else stops the undefined field warning.
I expect the classes to have differentiation based on the ---@class ClassName syntax, and not the file name.
Actual Behaviour
As you might expect from my description, it does give that warning until the file is renamed.
Reproduction steps
- Create a file "test/file.lua" with a class that doesn't implement "MyMethod"
- Create a file "file.lua" with a class that does implement "MyMethod"
- In your main file, require both, create an instance of both, and try to use MyMethod from instance from step 2
- Notice warning about class from step 1 not implementing MyMethod, despite not being used.
Additional Notes
In a small scale test, this didn't seem to happen. But in a full project, the program ran the method LLS says is undefined. Renaming the file and nothing else fixed it so it had something to do with that.
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
Reproduce la advertencia usando test/file.lua, file.lua y un archivo main que requiera ambos, tal como se describe en los pasos de reproducción. Empieza examinando los diagnósticos y la comprobación de sintaxis relacionados con la resolución de clases y tablas; se considerará terminado cuando la instancia de file.lua se compruebe contra su propia clase en lugar de contra la clase con el mismo nombre en test/file.lua.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- lua, vscode
- Área
- devtools
- 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