diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-09 23:21:54 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-10-09 23:21:54 +0200 |
commit | 71a8ac41fbea5bb97c25d66e17c06e8dfff4ebf1 (patch) | |
tree | 8cff3a7f5b0251620f3fe16804d0a7f8138452cf /editor/plugins/editor_preview_plugins.cpp | |
parent | 42425baa59956dc9d1e22341fe5e5d7f8fad5067 (diff) | |
parent | de7cbe87894cc9eaea1f3057fff7fe98f66aad25 (diff) | |
download | redot-engine-71a8ac41fbea5bb97c25d66e17c06e8dfff4ebf1.tar.gz |
Merge pull request #72751 from dalexeev/doc-comment-color
Highlight doc comments in a different color
Diffstat (limited to 'editor/plugins/editor_preview_plugins.cpp')
-rw-r--r-- | editor/plugins/editor_preview_plugins.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/plugins/editor_preview_plugins.cpp b/editor/plugins/editor_preview_plugins.cpp index 1872857130..afc72cdde6 100644 --- a/editor/plugins/editor_preview_plugins.cpp +++ b/editor/plugins/editor_preview_plugins.cpp @@ -496,6 +496,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from, Color text_color = EDITOR_GET("text_editor/theme/highlighting/text_color"); Color symbol_color = EDITOR_GET("text_editor/theme/highlighting/symbol_color"); Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color"); + Color doc_comment_color = EDITOR_GET("text_editor/theme/highlighting/doc_comment_color"); if (bg_color.a == 0) { bg_color = Color(0, 0, 0, 0); @@ -513,6 +514,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from, bool in_control_flow_keyword = false; bool in_keyword = false; bool in_comment = false; + bool in_doc_comment = false; for (int i = 0; i < code.length(); i++) { char32_t c = code[i]; if (c > 32) { @@ -520,11 +522,17 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from, Color color = text_color; if (c == '#') { - in_comment = true; + if (i < code.length() - 1 && code[i + 1] == '#') { + in_doc_comment = true; + } else { + in_comment = true; + } } if (in_comment) { color = comment_color; + } else if (in_doc_comment) { + color = doc_comment_color; } else { if (is_symbol(c)) { //make symbol a little visible @@ -569,6 +577,7 @@ Ref<Texture2D> EditorScriptPreviewPlugin::generate(const Ref<Resource> &p_from, if (c == '\n') { in_comment = false; + in_doc_comment = false; col = x0; line++; |