Merge pull request #84706 from HolonProduction/completion-get-child

Fix autocompletion after DOLLAR token
This commit is contained in:
Rémi Verschelde 2024-05-07 16:49:13 +02:00
commit ff018079a1
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -3199,6 +3199,9 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_call(ExpressionNode *p_pre
}
GDScriptParser::ExpressionNode *GDScriptParser::parse_get_node(ExpressionNode *p_previous_operand, bool p_can_assign) {
// We want code completion after a DOLLAR even if the current code is invalid.
make_completion_context(COMPLETION_GET_NODE, nullptr, -1, true);
if (!current.is_node_name() && !check(GDScriptTokenizer::Token::LITERAL) && !check(GDScriptTokenizer::Token::SLASH) && !check(GDScriptTokenizer::Token::PERCENT)) {
push_error(vformat(R"(Expected node path as string or identifier after "%s".)", previous.get_name()));
return nullptr;
@ -3254,7 +3257,7 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_get_node(ExpressionNode *p
path_state = PATH_STATE_SLASH;
}
make_completion_context(COMPLETION_GET_NODE, get_node, context_argument++);
make_completion_context(COMPLETION_GET_NODE, get_node, context_argument++, true);
if (match(GDScriptTokenizer::Token::LITERAL)) {
if (previous.literal.get_type() != Variant::STRING) {