LuaLS / LuaLS/lua-language-server
False negative: Warnings missing for table length mismatch
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?
NeoVim
Which OS are you using?
Linux
What is the issue affecting?
Type Checking, Diagnostics/Syntax Checking
Expected Behaviour
In the reproduction code below, f({0}) and f({0, 0, 0}) should issue warnings because they do not match the annotation [integer, integer], which requires a two-element table (tuple).
Actual Behaviour
There are no warnings issued for tables that have an invalid length.
I can see other warnings (e.g., for f("string")), so Neovim and other diagnostics are working correctly.
Reproduction steps
Open a text editor with lua-ls enabled and copy/paste this code.
---@alias Cursor [integer, integer]
---@param c Cursor
local function f(c) end
f("string")
f({ 0 })
f({ 0, 0, 0 })
Additional Notes
I tested with lua-language-server 3.9.1 and 3.13.2 and both have this problem.
Log File
I checked ~/.local/state/nvim/lsp.log since :LspInfo indicates it is the log file, but it was empty.
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
Beginne mit dem Reproduktionssnippet und dem Pfad für Typprüfung und Diagnosen von lua-language-server für Tabellen-Aliase. Vergleiche die bestehende Warnung für f("string") mit den fehlenden Warnungen für f({ 0 }) und f({ 0, 0, 0 }). Erledigt ist es, wenn Tupelannotationen eine Diagnose melden, wenn die Tabellenlänge von den erforderlichen zwei Elementen abweicht.
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