From 4cd16f6ba90c0dce40672f550f403fb76a74a940 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Thu, 12 Apr 2018 22:26:15 +0100 Subject: Added GDScript function definition highlighting --- modules/gdscript/editor/gdscript_highlighter.cpp | 11 ++++++++++- modules/gdscript/editor/gdscript_highlighter.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'modules/gdscript/editor') diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp index ac65b5bcb1..9e9e3df0ee 100644 --- a/modules/gdscript/editor/gdscript_highlighter.cpp +++ b/modules/gdscript/editor/gdscript_highlighter.cpp @@ -29,7 +29,9 @@ /*************************************************************************/ #include "gdscript_highlighter.h" +#include "../gdscript_tokenizer.h" #include "scene/gui/text_edit.h" +#include "editor/editor_settings.h" inline bool _is_symbol(CharType c) { @@ -232,7 +234,12 @@ Map GDScriptSyntaxHighlighter::_get_line_syntax_ color = member_color; } else if (in_function_name) { next_type = FUNCTION; - color = function_color; + + if (previous_text == GDScriptTokenizer::get_token_name(GDScriptTokenizer::TK_PR_FUNCTION)) { + color = function_definition_color; + } else { + color = function_color; + } } else if (is_symbol) { next_type = SYMBOL; color = symbol_color; @@ -294,6 +301,8 @@ void GDScriptSyntaxHighlighter::_update_cache() { function_color = text_editor->get_color("function_color"); number_color = text_editor->get_color("number_color"); member_color = text_editor->get_color("member_variable_color"); + + function_definition_color = EDITOR_DEF("text_editor/highlighting/gdscript/function_definition_color", Color::html("#01e1ff")); } SyntaxHighlighter *GDScriptSyntaxHighlighter::create() { diff --git a/modules/gdscript/editor/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h index 91c913be86..2180021735 100644 --- a/modules/gdscript/editor/gdscript_highlighter.h +++ b/modules/gdscript/editor/gdscript_highlighter.h @@ -50,6 +50,7 @@ private: Color font_color; Color symbol_color; Color function_color; + Color function_definition_color; Color built_in_type_color; Color number_color; Color member_color; -- cgit v1.2.3