summaryrefslogtreecommitdiffstats
path: root/editor/plugins/editor_preview_plugins.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/editor_preview_plugins.cpp')
-rw-r--r--editor/plugins/editor_preview_plugins.cpp11
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++;