LuaLS / LuaLS/lua-language-server
Auto-complete for table keys with @type breaks on non-locals
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Lua
- Sterne
- 4.4k
- Forks
- 442
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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?
Completion
Expected Behaviour
Using ---@type table<KeyType, ValueType> on a table should always keep auto-complete available for keys within the table.
Actual Behaviour
Auto-complete breaks if the table that ---@type was used on is global or within a class.
Reproduction steps
Scenario where auto-complete works:
---@class MyClass
---@field MyThings any
---@type table<string, MyClass>
local SomeTable = {
SomeKey = {MyField = 1},
SomeKey2 = {MyField = 1},
}
Scenario where auto-complete does not work:
---@class MyClass
---@field MyThings any
---@type table<string, MyClass>
SomeTable = {
SomeKey = {MyField = 1},
SomeKey2 = {MyField = 1},
}
No auto-complete will be available for SomeTable there. This also occurs if SomeTable is within a table marked with ---@class.
Additional Notes
No response
Log File
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere die beiden Szenarien zur Vervollständigung von Tabellenschlüsseln in der Visual Studio Code extension und vergleiche dabei lokale, globale und in Klassen enthaltene Tabellen, die mit table<KeyType, ValueType> annotiert sind. Verfolge die Verarbeitung der Vervollständigung für diese Annotationen und überprüfe, dass die Schlüsselvervollständigung in jedem Szenario verfügbar bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- lua
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100