mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
lsp: Report warnings correctly
Previously all diagnostics had the "error" severity, now warnings are correctly reported as such
This commit is contained in:
parent
93f2a27e35
commit
6576e02837
2 changed files with 14 additions and 1 deletions
|
@ -264,10 +264,15 @@ class LanguageServer:
|
||||||
})
|
})
|
||||||
|
|
||||||
def _create_diagnostic(self, text, err):
|
def _create_diagnostic(self, text, err):
|
||||||
|
if isinstance(err, CompileWarning):
|
||||||
|
severity = DiagnosticSeverity.Warning
|
||||||
|
else:
|
||||||
|
severity = DiagnosticSeverity.Error
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"range": utils.idxs_to_range(err.start, err.end, text),
|
"range": utils.idxs_to_range(err.start, err.end, text),
|
||||||
"message": err.message,
|
"message": err.message,
|
||||||
"severity": 1,
|
"severity": severity,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,14 @@ class SemanticTokenType(enum.IntEnum):
|
||||||
EnumMember = 0
|
EnumMember = 0
|
||||||
|
|
||||||
|
|
||||||
|
class DiagnosticSeverity(enum.IntEnum):
|
||||||
|
Error = 1
|
||||||
|
Warning = 2
|
||||||
|
Information = 3
|
||||||
|
Hint = 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class SemanticToken:
|
class SemanticToken:
|
||||||
start: int
|
start: int
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue