You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Fix highlight color for class attributes that are also keywords
Fixes #45338. This PR also makes any word after a "." not highlight as a keyword, i.e. the cos in Color.cos will highlight the same as any other class constant. Additionally, trying to do things like ".print()" will not highlight print as a keyword but as a class function.
This commit is contained in:
@@ -191,21 +191,23 @@ Map<int, TextEdit::HighlighterInfo> GDScriptSyntaxHighlighter::_get_line_syntax_
|
|||||||
col = text_editor->get_keyword_color(word);
|
col = text_editor->get_keyword_color(word);
|
||||||
} else if (text_editor->has_member_color(word)) {
|
} else if (text_editor->has_member_color(word)) {
|
||||||
col = text_editor->get_member_color(word);
|
col = text_editor->get_member_color(word);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (col != Color()) {
|
||||||
for (int k = j - 1; k >= 0; k--) {
|
for (int k = j - 1; k >= 0; k--) {
|
||||||
if (str[k] == '.') {
|
if (str[k] == '.') {
|
||||||
col = Color(); //member indexing not allowed
|
col = Color(); // keyword & member indexing not allowed
|
||||||
break;
|
break;
|
||||||
} else if (str[k] > 32) {
|
} else if (str[k] > 32) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (col != Color()) {
|
if (col != Color()) {
|
||||||
in_keyword = true;
|
in_keyword = true;
|
||||||
keyword_color = col;
|
keyword_color = col;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!in_function_name && in_word && !in_keyword) {
|
if (!in_function_name && in_word && !in_keyword) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user