You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to integrate LuaLS checking into CI so I am testing around with lua-language-server command line. In our codebase there are some functions marked with @deprecated, its default severity is 2 (Warning). We don't want it to be reported so I added the following setting into the .luarc.json:
Out of my expectation, the generated report includes all those redefined-local messages which are of severity level 4 (Hint). 😳 I have tried adding flag --checklevel=Warning but got same result.
With a bit of testing, if I tried to add diagnostics.severity setting (even if an empty table "diagnostics.severity": {}, ), then the generated report will ignore the --checklevel value.
Only if I remove the diagnostics.severity setting, the generated report becomes normal again (only reports Warning or above)
Reproduction steps
prepare a workspace with the following files
a.lua
locala
.luarc.json
{
"diagnostics.severity": {},
}
run command line ${path_to_luals}/bin/lua-language-server --check=.
it will output Diagnosis complete, 1 problems found, see ... check.json, and the file content of check.json
when removing "diagnostics.severity": {}, in .luarc.json, the diagnosis will not found any problem.
Additional Notes
Strange enough, with --checklevel=Error flag then the diagnosis will show no problems found 🤔.
But with either --checklevel=Warning and --checklevel=Information, the report will include these unused-local, which should be at hint level and should not be included.
Log File
No response
The text was updated successfully, but these errors were encountered:
The default severity value set by script/cli/check_worker#L86 seems incorrect when the Lua.diagnostics.severity config setting is incomplete.
It should be or serverity instead of or 'Warning', as otherwise any unset diagnostics.severity in the config table will be incorrectly treated as Warning, and thus not added to the disables[].
forname, serverityinpairs(define.DiagnosticDefaultSeverity) doserverity=config.get(rootUri, 'Lua.diagnostics.severity')[name] or'Warning' --<<< this should be `or serverity`ifserverity:sub(-1) =='!' thenserverity=serverity:sub(1, -2)
endifdefine.DiagnosticSeverity[serverity] >checkLevelthen-- the above logic error causing incorrect behavior of this level checkdisables[name] =trueend
I've tested the change locally and it's working as expected now 🎉
I may soon open a pr for it 😄
ps:
btw the variable name serverity contains a typo, it should be severity 🙂
How are you using the lua-language-server?
Command Line
Which OS are you using?
MacOS
What is the issue affecting?
Diagnostics/Syntax Checking
Expected Behaviour
I am trying to integrate LuaLS checking into CI so I am testing around with
lua-language-server
command line. In our codebase there are some functions marked with@deprecated
, its default severity is2
(Warning). We don't want it to be reported so I added the following setting into the.luarc.json
:I expected that when running the following command, the report will not contains
deprecated
(as the severity is downgraded):${path_to_luals}/bin/lua-language-server --check=.
Actual Behaviour
Out of my expectation, the generated report includes all those
redefined-local
messages which are of severity level4
(Hint). 😳 I have tried adding flag--checklevel=Warning
but got same result.With a bit of testing, if I tried to add
diagnostics.severity
setting (even if an empty table"diagnostics.severity": {},
), then the generated report will ignore the--checklevel
value.Only if I remove the
diagnostics.severity
setting, the generated report becomes normal again (only reportsWarning
or above)Reproduction steps
.luarc.json
{ "diagnostics.severity": {}, }
${path_to_luals}/bin/lua-language-server --check=.
Diagnosis complete, 1 problems found, see ... check.json
, and the file content ofcheck.json
"diagnostics.severity": {},
in.luarc.json
, the diagnosis will not found any problem.Additional Notes
Strange enough, with
--checklevel=Error
flag then the diagnosis will show no problems found 🤔.But with either
--checklevel=Warning
and--checklevel=Information
, the report will include theseunused-local
, which should be athint
level and should not be included.Log File
No response
The text was updated successfully, but these errors were encountered: