diff --git a/editor_modules/editor_code_editor/editor_syntax_highlighter.cpp b/editor_modules/editor_code_editor/editor_syntax_highlighter.cpp index ddf8d2351..6c0becf99 100644 --- a/editor_modules/editor_code_editor/editor_syntax_highlighter.cpp +++ b/editor_modules/editor_code_editor/editor_syntax_highlighter.cpp @@ -30,8 +30,8 @@ #include "editor_syntax_highlighter.h" -#include "editor/editor_settings.h" #include "core/config/project_settings.h" +#include "editor/editor_settings.h" #include "editor_script_editor.h" /*** SYNTAX HIGHLIGHTER ****/ @@ -143,10 +143,15 @@ void EditorStandardSyntaxHighlighter::_update_cache() { /* Reserved words. */ const Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); + const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color"); List keywords; script->get_language()->get_reserved_words(&keywords); for (List::Element *E = keywords.front(); E; E = E->next()) { - highlighter->add_keyword_color(E->get(), keyword_color); + if (script->get_language()->is_control_flow_keyword(E->get())) { + highlighter->add_keyword_color(E->get(), control_flow_keyword_color); + } else { + highlighter->add_keyword_color(E->get(), keyword_color); + } } /* Member types. */ diff --git a/editor_modules/shader_editor/shader_editor_plugin.cpp b/editor_modules/shader_editor/shader_editor_plugin.cpp index 96aedaa43..834cc3621 100644 --- a/editor_modules/shader_editor/shader_editor_plugin.cpp +++ b/editor_modules/shader_editor/shader_editor_plugin.cpp @@ -168,12 +168,17 @@ void ShaderTextEditor::_load_theme_settings() { syntax_highlighter->set_member_variable_color(EDITOR_GET("text_editor/highlighting/member_variable_color")); const Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); + const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color"); List keywords; ShaderLanguage::get_keyword_list(&keywords); for (List::Element *E = keywords.front(); E; E = E->next()) { - syntax_highlighter->add_keyword_color(E->get(), keyword_color); + if (ShaderLanguage::is_control_flow_keyword(E->get())) { + syntax_highlighter->add_keyword_color(E->get(), control_flow_keyword_color); + } else { + syntax_highlighter->add_keyword_color(E->get(), keyword_color); + } } // Colorize built-ins like `COLOR` differently to make them easier diff --git a/modules/cscript/editor/cscript_highlighter.cpp b/modules/cscript/editor/cscript_highlighter.cpp index 138997289..bf9ba62fb 100644 --- a/modules/cscript/editor/cscript_highlighter.cpp +++ b/modules/cscript/editor/cscript_highlighter.cpp @@ -31,8 +31,8 @@ #include "cscript_highlighter.h" #include "../cscript.h" #include "../cscript_tokenizer.h" -#include "editor/editor_settings.h" #include "core/config/project_settings.h" +#include "editor/editor_settings.h" static bool _is_char(CharType c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_'; @@ -412,7 +412,6 @@ Dictionary CScriptSyntaxHighlighter::_get_line_syntax_highlighting(int p_line) { return color_map; } - String CScriptSyntaxHighlighter::_get_name() const { return "CScript"; } @@ -492,10 +491,15 @@ void CScriptSyntaxHighlighter::_update_cache() { /* Reserved words. */ const Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); + const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color"); List keyword_list; cscript->get_reserved_words(&keyword_list); for (List::Element *E = keyword_list.front(); E; E = E->next()) { - keywords[E->get()] = keyword_color; + if (cscript->is_control_flow_keyword(E->get())) { + keywords[E->get()] = control_flow_keyword_color; + } else { + keywords[E->get()] = keyword_color; + } } /* Comments */ diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index 5388c53d2..d70d90c80 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -508,10 +508,15 @@ void GDScriptSyntaxHighlighter::_update_cache() { /* Reserved words. */ const Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color"); + const Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color"); List keyword_list; gdscript->get_reserved_words(&keyword_list); for (List::Element *E = keyword_list.front(); E; E = E->next()) { - keywords[E->get()] = keyword_color; + if (gdscript->is_control_flow_keyword(E->get())) { + keywords[E->get()] = control_flow_keyword_color; + } else { + keywords[E->get()] = keyword_color; + } } /* Comments */