-
-
Notifications
You must be signed in to change notification settings - Fork 383
Description
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 is 2
(Warning). We don't want it to be reported so I added the following setting into the .luarc.json
:
"diagnostics.severity": {
"deprecated": "Information!"
},
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 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
local a
.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 ofcheck.json
{
"file:///Users/tomlau10/projects/temp/./a.lua": [
{
"code": "unused-local",
"message": "Unused local `a`.",
"range": {
"end": {
"character": 7,
"line": 0
},
"start": {
"character": 6,
"line": 0
}
},
"severity": 4,
"source": "Lua Diagnostics.",
"tags": [
1
]
}
]
}
- 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