diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 74d82aa4a25..6d747ba6a83 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -33,6 +33,7 @@ #include "core/config/project_settings.h" #include "core/input/input.h" #include "core/io/file_access.h" +#include "core/io/json.h" #include "core/io/resource_loader.h" #include "core/os/keyboard.h" #include "core/os/os.h" @@ -209,6 +210,27 @@ Ref EditorPlainTextSyntaxHighlighter::_create() const { return syntax_highlighter; } +//// + +void EditorJSONSyntaxHighlighter::_update_cache() { + highlighter->set_text_edit(text_edit); + highlighter->clear_keyword_colors(); + highlighter->clear_member_keyword_colors(); + highlighter->clear_color_regions(); + + highlighter->set_symbol_color(EDITOR_GET("text_editor/theme/highlighting/symbol_color")); + highlighter->set_number_color(EDITOR_GET("text_editor/theme/highlighting/number_color")); + + const Color string_color = EDITOR_GET("text_editor/theme/highlighting/string_color"); + highlighter->add_color_region("\"", "\"", string_color); +} + +Ref EditorJSONSyntaxHighlighter::_create() const { + Ref syntax_highlighter; + syntax_highlighter.instantiate(); + return syntax_highlighter; +} + //////////////////////////////////////////////////////////////////////////////// /*** SCRIPT EDITOR ****/ @@ -702,9 +724,10 @@ void ScriptEditor::_open_recent_script(int p_idx) { if (FileAccess::exists(path)) { List extensions; ResourceLoader::get_recognized_extensions_for_type("Script", &extensions); + ResourceLoader::get_recognized_extensions_for_type("JSON", &extensions); if (extensions.find(path.get_extension())) { - Ref