summaryrefslogtreecommitdiff
path: root/modules/gdscript/editor
diff options
context:
space:
mode:
authorPaulb23 <p_batty@hotmail.co.uk>2018-04-12 23:49:44 +0100
committerPaulb23 <p_batty@hotmail.co.uk>2018-04-20 21:00:07 +0100
commitadeed584776a7b91d2de6dd5cbb43fe3e35114e1 (patch)
tree2e199cb0fb5e685c18255918afa7a2489645855b /modules/gdscript/editor
parent4cd16f6ba90c0dce40672f550f403fb76a74a940 (diff)
Added GDScript NodePath highlighting
Diffstat (limited to 'modules/gdscript/editor')
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.cpp13
-rw-r--r--modules/gdscript/editor/gdscript_highlighter.h2
2 files changed, 14 insertions, 1 deletions
diff --git a/modules/gdscript/editor/gdscript_highlighter.cpp b/modules/gdscript/editor/gdscript_highlighter.cpp
index 9e9e3df0ee..ea3efff9cf 100644
--- a/modules/gdscript/editor/gdscript_highlighter.cpp
+++ b/modules/gdscript/editor/gdscript_highlighter.cpp
@@ -30,8 +30,8 @@
#include "gdscript_highlighter.h"
#include "../gdscript_tokenizer.h"
-#include "scene/gui/text_edit.h"
#include "editor/editor_settings.h"
+#include "scene/gui/text_edit.h"
inline bool _is_symbol(CharType c) {
@@ -76,6 +76,7 @@ Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_
bool in_word = false;
bool in_function_name = false;
bool in_member_variable = false;
+ bool in_node_path = false;
bool is_hex_notation = false;
Color keyword_color;
Color color;
@@ -223,9 +224,18 @@ Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_
in_member_variable = false;
}
+ if (!in_node_path && in_region == -1 && str[j] == '$') {
+ in_node_path = true;
+ } else if (in_region != -1 || (is_symbol && str[j] != '/')) {
+ in_node_path = false;
+ }
+
if (in_region >= 0) {
next_type = REGION;
color = text_editor->_get_color_region(in_region).color;
+ } else if (in_node_path) {
+ next_type = NODE_PATH;
+ color = node_path_color;
} else if (in_keyword) {
next_type = KEYWORD;
color = keyword_color;
@@ -303,6 +313,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
member_color = text_editor->get_color("member_variable_color");
function_definition_color = EDITOR_DEF("text_editor/highlighting/gdscript/function_definition_color", Color::html("#01e1ff"));
+ node_path_color = EDITOR_DEF("text_editor/highlighting/gdscript/node_path_color", Color::html("#64c15a"));
}
SyntaxHighlighter *GDScriptSyntaxHighlighter::create() {
diff --git a/modules/gdscript/editor/gdscript_highlighter.h b/modules/gdscript/editor/gdscript_highlighter.h
index 2180021735..0296ab7652 100644
--- a/modules/gdscript/editor/gdscript_highlighter.h
+++ b/modules/gdscript/editor/gdscript_highlighter.h
@@ -38,6 +38,7 @@ private:
enum Type {
NONE,
REGION,
+ NODE_PATH,
SYMBOL,
NUMBER,
FUNCTION,
@@ -54,6 +55,7 @@ private:
Color built_in_type_color;
Color number_color;
Color member_color;
+ Color node_path_color;
public:
static SyntaxHighlighter *create();