mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Merge pull request #96693 from HolonProduction/annotation-arg-hint
Autocompletion: Add arghint for annotations
This commit is contained in:
commit
0b2446101c
2 changed files with 14 additions and 7 deletions
|
@ -1640,23 +1640,29 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
|
|||
advance();
|
||||
// Arguments.
|
||||
push_completion_call(annotation);
|
||||
make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, 0);
|
||||
int argument_index = 0;
|
||||
do {
|
||||
make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, argument_index);
|
||||
set_last_completion_call_arg(argument_index);
|
||||
if (check(GDScriptTokenizer::Token::PARENTHESIS_CLOSE)) {
|
||||
// Allow for trailing comma.
|
||||
break;
|
||||
}
|
||||
|
||||
make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, argument_index);
|
||||
set_last_completion_call_arg(argument_index++);
|
||||
ExpressionNode *argument = parse_expression(false);
|
||||
|
||||
if (argument == nullptr) {
|
||||
push_error("Expected expression as the annotation argument.");
|
||||
valid = false;
|
||||
continue;
|
||||
} else {
|
||||
annotation->arguments.push_back(argument);
|
||||
|
||||
if (argument->type == Node::LITERAL) {
|
||||
override_completion_context(argument, COMPLETION_ANNOTATION_ARGUMENTS, annotation, argument_index);
|
||||
}
|
||||
}
|
||||
annotation->arguments.push_back(argument);
|
||||
|
||||
argument_index++;
|
||||
} while (match(GDScriptTokenizer::Token::COMMA) && !is_at_end());
|
||||
|
||||
pop_multiline();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue