Fix autocompletion after DOLLAR token

This commit is contained in:
HolonProduction 2023-11-10 12:01:17 +01:00
parent 7d2ca2d8ac
commit 1621e725fa

View file

@ -3121,6 +3121,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;
@ -3175,7 +3178,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) {