Added GDScript NodePath highlighting
This commit is contained in:
parent
4cd16f6ba9
commit
adeed58477
@ -586,6 +586,7 @@ void EditorSettings::_load_default_text_editor_theme() {
|
||||
|
||||
// GDScript highlighter
|
||||
_initial_set("text_editor/highlighting/gdscript/function_definition_color", Color::html("#01e1ff"));
|
||||
_initial_set("text_editor/highlighting/gdscript/node_path_color", Color::html("#64c15a"));
|
||||
}
|
||||
|
||||
bool EditorSettings::_save_text_editor_theme(String p_file) {
|
||||
@ -624,6 +625,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) {
|
||||
|
||||
//GDScript highlighter
|
||||
cf->set_value(theme_section, "gdscript/function_definition_color", ((Color)get("text_editor/highlighting/gdscript/function_definition_color")).to_html());
|
||||
cf->set_value(theme_section, "gdscript/node_path_color", ((Color)get("text_editor/highlighting/gdscript/node_path_color")).to_html());
|
||||
|
||||
Error err = cf->save(p_file);
|
||||
|
||||
|
@ -1040,6 +1040,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
const Color string_color = Color::html(dark_theme ? "#ffd942" : "#ffd118").linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
|
||||
|
||||
const Color function_definition_color = Color::html(dark_theme ? "#01e1ff" : "#00a5ba");
|
||||
const Color node_path_color = Color::html(dark_theme ? "64c15a" : "#518b4b");
|
||||
|
||||
const Color te_background_color = Color(0, 0, 0, 0);
|
||||
const Color completion_background_color = base_color;
|
||||
@ -1101,6 +1102,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
setting->set_initial_value("text_editor/highlighting/search_result_border_color", search_result_border_color, true);
|
||||
|
||||
setting->set_initial_value("text_editor/highlighting/gdscript/function_definition_color", function_definition_color, true);
|
||||
setting->set_initial_value("text_editor/highlighting/gdscript/node_path_color", node_path_color, true);
|
||||
} else if (text_editor_color_theme == "Default") {
|
||||
setting->set_initial_value("text_editor/highlighting/symbol_color", Color::html("badfff"), true);
|
||||
setting->set_initial_value("text_editor/highlighting/keyword_color", Color::html("ffffb3"), true);
|
||||
@ -1134,6 +1136,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
|
||||
setting->set_initial_value("text_editor/highlighting/search_result_border_color", Color(0.1, 0.45, 0.1, 1), true);
|
||||
|
||||
setting->set_initial_value("text_editor/highlighting/gdscript/function_definition_color", Color::html("#01e1ff"), true);
|
||||
setting->set_initial_value("text_editor/highlighting/gdscript/node_path_color", Color::html("#64c15a"), true);
|
||||
}
|
||||
|
||||
return theme;
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user