lsp: Report warnings correctly

Previously all diagnostics had the "error" severity, now warnings are
correctly reported as such
This commit is contained in:
James Westman 2022-03-15 23:06:45 -05:00
parent 93f2a27e35
commit 6576e02837
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
2 changed files with 14 additions and 1 deletions

View file

@ -264,10 +264,15 @@ class LanguageServer:
})
def _create_diagnostic(self, text, err):
if isinstance(err, CompileWarning):
severity = DiagnosticSeverity.Warning
else:
severity = DiagnosticSeverity.Error
return {
"range": utils.idxs_to_range(err.start, err.end, text),
"message": err.message,
"severity": 1,
"severity": severity,
}