diff --git a/blueprintcompiler/lsp.py b/blueprintcompiler/lsp.py index 60f7412..fbc45ea 100644 --- a/blueprintcompiler/lsp.py +++ b/blueprintcompiler/lsp.py @@ -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, } diff --git a/blueprintcompiler/lsp_utils.py b/blueprintcompiler/lsp_utils.py index 062b7e4..5664ab6 100644 --- a/blueprintcompiler/lsp_utils.py +++ b/blueprintcompiler/lsp_utils.py @@ -103,6 +103,14 @@ class SemanticTokenType(enum.IntEnum): EnumMember = 0 +class DiagnosticSeverity(enum.IntEnum): + Error = 1 + Warning = 2 + Information = 3 + Hint = 4 + + + @dataclass class SemanticToken: start: int