Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

LSP: Display warning code in diagnostic "code" field instead of message

Malcolm Andersona1b6e4f32c47
diff --git a/modules/gdscript/language_server/gdscript_extend_parser.cpp b/modules/gdscript/language_server/gdscript_extend_parser.cpp
index 31ed4d7a83e..122fca998b5 100644
--- a/modules/gdscript/language_server/gdscript_extend_parser.cpp
+++ b/modules/gdscript/language_server/gdscript_extend_parser.cpp
@@ -81,8 +81,9 @@ void ExtendGDScriptParser::update_diagnostics() {
for (const GDScriptWarning &warning : parser_warnings) {
LSP::Diagnostic diagnostic;
diagnostic.severity = LSP::DiagnosticSeverity::Warning;
- diagnostic.message = "(" + warning.get_name() + "): " + warning.get_message();
+ diagnostic.message = warning.get_message();
diagnostic.source = "gdscript";
+ diagnostic.code = warning.get_name();
GodotRange godot_range(
GodotPosition(warning.start_line, warning.start_column),
diff --git a/modules/gdscript/language_server/godot_lsp.h b/modules/gdscript/language_server/godot_lsp.h
index a49fe8432dd..86a739774b5 100644
--- a/modules/gdscript/language_server/godot_lsp.h
+++ b/modules/gdscript/language_server/godot_lsp.h
@@ -774,7 +774,7 @@ struct Diagnostic {
/**
* The diagnostic's code, which might appear in the user interface.
*/
- int code = 0;
+ String code;
/**
* A human-readable string describing the source of this