mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
This commit is contained in:
parent
758bccf364
commit
e905e8f145
20 changed files with 115 additions and 9 deletions
|
@ -736,6 +736,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
|
|||
Color background_color = EDITOR_GET("text_editor/highlighting/background_color");
|
||||
Color text_color = EDITOR_GET("text_editor/highlighting/text_color");
|
||||
Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
|
||||
Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
|
||||
Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
|
||||
Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color");
|
||||
Color function_color = EDITOR_GET("text_editor/highlighting/function_color");
|
||||
|
@ -746,7 +747,11 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) {
|
|||
expression_box->add_theme_color_override("background_color", background_color);
|
||||
|
||||
for (List<String>::Element *E = VisualShaderEditor::get_singleton()->keyword_list.front(); E; E = E->next()) {
|
||||
expression_syntax_highlighter->add_keyword_color(E->get(), keyword_color);
|
||||
if (ShaderLanguage::is_control_flow_keyword(E->get())) {
|
||||
expression_syntax_highlighter->add_keyword_color(E->get(), control_flow_keyword_color);
|
||||
} else {
|
||||
expression_syntax_highlighter->add_keyword_color(E->get(), keyword_color);
|
||||
}
|
||||
}
|
||||
|
||||
expression_box->add_theme_font_override("font", VisualShaderEditor::get_singleton()->get_theme_font("expression", "EditorFonts"));
|
||||
|
@ -2803,6 +2808,7 @@ void VisualShaderEditor::_notification(int p_what) {
|
|||
Color background_color = EDITOR_GET("text_editor/highlighting/background_color");
|
||||
Color text_color = EDITOR_GET("text_editor/highlighting/text_color");
|
||||
Color keyword_color = EDITOR_GET("text_editor/highlighting/keyword_color");
|
||||
Color control_flow_keyword_color = EDITOR_GET("text_editor/highlighting/control_flow_keyword_color");
|
||||
Color comment_color = EDITOR_GET("text_editor/highlighting/comment_color");
|
||||
Color symbol_color = EDITOR_GET("text_editor/highlighting/symbol_color");
|
||||
Color function_color = EDITOR_GET("text_editor/highlighting/function_color");
|
||||
|
@ -2812,7 +2818,11 @@ void VisualShaderEditor::_notification(int p_what) {
|
|||
preview_text->add_theme_color_override("background_color", background_color);
|
||||
|
||||
for (List<String>::Element *E = keyword_list.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);
|
||||
}
|
||||
}
|
||||
|
||||
preview_text->add_theme_font_override("font", get_theme_font("expression", "EditorFonts"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue