|
@@ -32,6 +32,7 @@
|
|
|
|
|
|
#include "core/config/project_settings.h"
|
|
|
#include "core/input/input.h"
|
|
|
+#include "core/io/config_file.h"
|
|
|
#include "core/io/file_access.h"
|
|
|
#include "core/io/json.h"
|
|
|
#include "core/io/resource_loader.h"
|
|
@@ -302,6 +303,46 @@ Ref<EditorSyntaxHighlighter> EditorMarkdownSyntaxHighlighter::_create() const {
|
|
|
return syntax_highlighter;
|
|
|
}
|
|
|
|
|
|
+///
|
|
|
+
|
|
|
+void EditorConfigFileSyntaxHighlighter::_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"));
|
|
|
+ // Assume that all function-style syntax is for types such as `Vector2()` and `PackedStringArray()`.
|
|
|
+ highlighter->set_function_color(EDITOR_GET("text_editor/theme/highlighting/base_type_color"));
|
|
|
+
|
|
|
+ // Disable member variable highlighting as it's not relevant for ConfigFile.
|
|
|
+ highlighter->set_member_variable_color(EDITOR_GET("text_editor/theme/highlighting/text_color"));
|
|
|
+
|
|
|
+ const Color string_color = EDITOR_GET("text_editor/theme/highlighting/string_color");
|
|
|
+ highlighter->add_color_region("\"", "\"", string_color);
|
|
|
+
|
|
|
+ // FIXME: Sections in ConfigFile must be at the beginning of a line. Otherwise, it can be an array within a line.
|
|
|
+ const Color function_color = EDITOR_GET("text_editor/theme/highlighting/function_color");
|
|
|
+ highlighter->add_color_region("[", "]", function_color);
|
|
|
+
|
|
|
+ const Color keyword_color = EDITOR_GET("text_editor/theme/highlighting/keyword_color");
|
|
|
+ highlighter->add_keyword_color("true", keyword_color);
|
|
|
+ highlighter->add_keyword_color("false", keyword_color);
|
|
|
+ highlighter->add_keyword_color("null", keyword_color);
|
|
|
+ highlighter->add_keyword_color("ExtResource", keyword_color);
|
|
|
+ highlighter->add_keyword_color("SubResource", keyword_color);
|
|
|
+
|
|
|
+ const Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color");
|
|
|
+ highlighter->add_color_region(";", "", comment_color);
|
|
|
+}
|
|
|
+
|
|
|
+Ref<EditorSyntaxHighlighter> EditorConfigFileSyntaxHighlighter::_create() const {
|
|
|
+ Ref<EditorConfigFileSyntaxHighlighter> syntax_highlighter;
|
|
|
+ syntax_highlighter.instantiate();
|
|
|
+ return syntax_highlighter;
|
|
|
+}
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
/*** SCRIPT EDITOR ****/
|
|
@@ -4450,6 +4491,10 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) {
|
|
|
markdown_syntax_highlighter.instantiate();
|
|
|
register_syntax_highlighter(markdown_syntax_highlighter);
|
|
|
|
|
|
+ Ref<EditorConfigFileSyntaxHighlighter> config_file_syntax_highlighter;
|
|
|
+ config_file_syntax_highlighter.instantiate();
|
|
|
+ register_syntax_highlighter(config_file_syntax_highlighter);
|
|
|
+
|
|
|
_update_online_doc();
|
|
|
}
|
|
|
|