Feature Request: Add an option to require type annotations
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 42/100
Direzione di ricerca
Inizia dalla configurazione .luarc.json e dalle diagnosi esistenti incomplete-signature-doc, missing-global-doc e missing-local-export-doc per capire come vengono abilitate e promosse le diagnosi. Definisci l'ambito della nuova diagnosi per le funzioni, le variabili di tabella globali e le annotazioni di tabella, quindi convalida il comportamento richiesto di avviso ed errore in base agli esempi nell'issue.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Desire
I would like a way for lua-language-server to apply a "strict" mode to the functions and tables variables of lua files. e.g. if a function takes at least one parameter or has at least one return <foo> statement, it would error if that function doesn't also have a ---@param / ---@return statement to match it.
Issue
There seems to be some arguments that can make lua-language-server more strict, for example these:
.luarc.json
{
"diagnostics": {
"neededFileStatus": {
"incomplete-signature-doc": "Any",
"missing-global-doc": "Any",
"missing-local-export-doc": "Any"
},
"severity": {
"incomplete-signature-doc": "Error",
"missing-global-doc": "Error",
"missing-local-export-doc": "Error"
}
},
}
But they seem to activate only on inlined functions or functions that have incomplete documentation. So if a function has no docs at all, it gets skipped.
Suggestion
A new diagnostic that maybe can be a warning but can be escalated to an error. And it basically says
- If it is a global variable table, it needs a
---@type - If it is a function
- And it has at least one parameter
- Each parameter must define
---@paramwith a name + type
- Each parameter must define
- And it has at least one non-bare-return `return
- Each parameter must define
---@returnwith type
- Each parameter must define
- And it has at least one parameter
- If the type annotation is a table
- Require that the table is "filled out" with concrete types. e.g.
---@type table->---@type table<string, integer>
- Require that the table is "filled out" with concrete types. e.g.
Something along these lines
- Lingua principale
- Lua
- Stelle
- 4.4k
- Fork
- 442
- Merge medio
- 8g 9h
- PR unite (30g)
- 1
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.
Altre issue di LuaLS/lua-language-server
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
LuaLS/lua-language-server#1776 ·
-
泛型for迭代器的类型推导漏掉了带__call的类 Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
LuaLS/lua-language-server#3463 · 5 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
LuaLS/lua-language-server#3461 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
LuaLS/lua-language-server#3460 · 1 commento · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
LuaLS/lua-language-server#3459 · 1 reazione ·
Tutte le issue di LuaLS/lua-language-server
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
LandSandBoat/server#11579 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ArchiveTeam/sinavideo-grab#7 · 3 reazioni ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mailcow/mailcow-dockerized#7480 ·
-
mapper bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
documentation feature-request mini.completion
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100