|
@@ -430,6 +430,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
|
|
|
expect_type = false;
|
|
|
} else if (member_keywords.has(word)) {
|
|
|
col = member_keywords[word];
|
|
|
+ in_member_variable = true;
|
|
|
}
|
|
|
|
|
|
if (col != Color()) {
|
|
@@ -442,7 +443,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (col != Color()) {
|
|
|
+ if (!in_member_variable && col != Color()) {
|
|
|
in_keyword = true;
|
|
|
keyword_color = col;
|
|
|
}
|
|
@@ -627,7 +628,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
|
|
|
color = keyword_color;
|
|
|
} else if (in_signal_declaration) {
|
|
|
next_type = SIGNAL;
|
|
|
- color = member_color;
|
|
|
+ color = member_variable_color;
|
|
|
} else if (in_function_name) {
|
|
|
next_type = FUNCTION;
|
|
|
if (!in_lambda && in_function_declaration) {
|
|
@@ -646,7 +647,7 @@ Dictionary GDScriptSyntaxHighlighter::_get_line_syntax_highlighting_impl(int p_l
|
|
|
color = type_color;
|
|
|
} else if (in_member_variable) {
|
|
|
next_type = MEMBER;
|
|
|
- color = member_color;
|
|
|
+ color = member_variable_color;
|
|
|
} else {
|
|
|
next_type = IDENTIFIER;
|
|
|
}
|
|
@@ -709,7 +710,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
|
|
|
symbol_color = EDITOR_GET("text_editor/theme/highlighting/symbol_color");
|
|
|
function_color = EDITOR_GET("text_editor/theme/highlighting/function_color");
|
|
|
number_color = EDITOR_GET("text_editor/theme/highlighting/number_color");
|
|
|
- member_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color");
|
|
|
+ member_variable_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color");
|
|
|
|
|
|
/* Engine types. */
|
|
|
const Color types_color = EDITOR_GET("text_editor/theme/highlighting/engine_type_color");
|
|
@@ -779,7 +780,7 @@ void GDScriptSyntaxHighlighter::_update_cache() {
|
|
|
global_functions.insert(E);
|
|
|
}
|
|
|
|
|
|
- /* Comments */
|
|
|
+ /* Comments. */
|
|
|
const Color comment_color = EDITOR_GET("text_editor/theme/highlighting/comment_color");
|
|
|
for (const String &comment : gdscript->get_comment_delimiters()) {
|
|
|
String beg = comment.get_slicec(' ', 0);
|
|
@@ -811,15 +812,14 @@ void GDScriptSyntaxHighlighter::_update_cache() {
|
|
|
add_color_region(ColorRegion::TYPE_MULTILINE_STRING, "\"\"\"", "\"\"\"", string_color, false, true);
|
|
|
add_color_region(ColorRegion::TYPE_MULTILINE_STRING, "'''", "'''", string_color, false, true);
|
|
|
|
|
|
- const Ref<Script> scr = _get_edited_resource();
|
|
|
+ /* Members. */
|
|
|
+ Ref<Script> scr = _get_edited_resource();
|
|
|
if (scr.is_valid()) {
|
|
|
- /* Member types. */
|
|
|
- const Color member_variable_color = EDITOR_GET("text_editor/theme/highlighting/member_variable_color");
|
|
|
StringName instance_base = scr->get_instance_base_type();
|
|
|
if (instance_base != StringName()) {
|
|
|
- List<PropertyInfo> plist;
|
|
|
- ClassDB::get_property_list(instance_base, &plist);
|
|
|
- for (const PropertyInfo &E : plist) {
|
|
|
+ List<PropertyInfo> property_list;
|
|
|
+ ClassDB::get_property_list(instance_base, &property_list);
|
|
|
+ for (const PropertyInfo &E : property_list) {
|
|
|
String prop_name = E.name;
|
|
|
if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
|
|
|
continue;
|
|
@@ -830,12 +830,61 @@ void GDScriptSyntaxHighlighter::_update_cache() {
|
|
|
member_keywords[prop_name] = member_variable_color;
|
|
|
}
|
|
|
|
|
|
- List<String> clist;
|
|
|
- ClassDB::get_integer_constant_list(instance_base, &clist);
|
|
|
- for (const String &E : clist) {
|
|
|
+ List<MethodInfo> signal_list;
|
|
|
+ ClassDB::get_signal_list(instance_base, &signal_list);
|
|
|
+ for (const MethodInfo &E : signal_list) {
|
|
|
+ member_keywords[E.name] = member_variable_color;
|
|
|
+ }
|
|
|
+
|
|
|
+ // For callables.
|
|
|
+ List<MethodInfo> method_list;
|
|
|
+ ClassDB::get_method_list(instance_base, &method_list);
|
|
|
+ for (const MethodInfo &E : method_list) {
|
|
|
+ member_keywords[E.name] = member_variable_color;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<String> constant_list;
|
|
|
+ ClassDB::get_integer_constant_list(instance_base, &constant_list);
|
|
|
+ for (const String &E : constant_list) {
|
|
|
member_keywords[E] = member_variable_color;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ List<PropertyInfo> scr_property_list;
|
|
|
+ scr->get_script_property_list(&scr_property_list);
|
|
|
+ for (const PropertyInfo &E : scr_property_list) {
|
|
|
+ String prop_name = E.name;
|
|
|
+ if (E.usage & PROPERTY_USAGE_CATEGORY || E.usage & PROPERTY_USAGE_GROUP || E.usage & PROPERTY_USAGE_SUBGROUP) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (prop_name.contains_char('/')) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ member_keywords[prop_name] = member_variable_color;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<MethodInfo> scr_signal_list;
|
|
|
+ scr->get_script_signal_list(&scr_signal_list);
|
|
|
+ for (const MethodInfo &E : scr_signal_list) {
|
|
|
+ member_keywords[E.name] = member_variable_color;
|
|
|
+ }
|
|
|
+
|
|
|
+ // For callables.
|
|
|
+ List<MethodInfo> scr_method_list;
|
|
|
+ scr->get_script_method_list(&scr_method_list);
|
|
|
+ for (const MethodInfo &E : scr_method_list) {
|
|
|
+ member_keywords[E.name] = member_variable_color;
|
|
|
+ }
|
|
|
+
|
|
|
+ Ref<Script> scr_class = scr;
|
|
|
+ while (scr_class.is_valid()) {
|
|
|
+ HashMap<StringName, Variant> scr_constant_list;
|
|
|
+ scr_class->get_constants(&scr_constant_list);
|
|
|
+ for (const KeyValue<StringName, Variant> &E : scr_constant_list) {
|
|
|
+ member_keywords[E.key.operator String()] = member_variable_color;
|
|
|
+ }
|
|
|
+ scr_class = scr_class->get_base_script();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const String text_edit_color_theme = EDITOR_GET("text_editor/theme/color_theme");
|