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
---@param with a name + type
- And it has at least one non-bare-return `return
- Each parameter must define
---@return with type
- 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>
Something along these lines
Desire
I would like a way for
lua-language-serverto 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 onereturn <foo>statement, it would error if that function doesn't also have a---@param/---@returnstatement to match it.Issue
There seems to be some arguments that can make
lua-language-servermore 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
---@type---@paramwith a name + type---@returnwith type---@type table->---@type table<string, integer>Something along these lines