LuaLS / LuaLS/lua-language-server
Class definitions get confused with same filenames across folders.
Nessuno ha ancora preso questa issue.
- Lingua principale
- Lua
- Stelle
- 4.4k
- Fork
- 442
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci l'avviso usando test/file.lua, file.lua e un file main che richieda entrambi, come descritto nei passaggi per la riproduzione. Inizia esaminando la diagnostica e il controllo della sintassi relativi alla risoluzione di classi e tabelle; il lavoro è completato quando l'istanza di file.lua viene verificata rispetto alla propria classe anziché rispetto alla classe omonima in test/file.lua.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- lua, vscode
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100