Skip to content

Commit 926cab9

Browse files
Autocompletion: Push empty call for lambdas
1 parent 0dd9178 commit 926cab9

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

modules/gdscript/gdscript_parser.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3618,6 +3618,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_lambda(ExpressionNode *p_p
36183618

36193619
bool multiline_context = multiline_stack.back()->get();
36203620

3621+
push_completion_call(nullptr);
3622+
36213623
// Reset the multiline stack since we don't want the multiline mode one in the lambda body.
36223624
push_multiline(false);
36233625
if (multiline_context) {
@@ -3665,6 +3667,8 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_lambda(ExpressionNode *p_p
36653667

36663668
pop_multiline();
36673669

3670+
pop_completion_call();
3671+
36683672
if (multiline_context) {
36693673
// If we're in multiline mode, we want to skip the spurious DEDENT and NEWLINE tokens.
36703674
while (check(GDScriptTokenizer::Token::DEDENT) || check(GDScriptTokenizer::Token::INDENT) || check(GDScriptTokenizer::Token::NEWLINE)) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[output]
2+
include=[
3+
{"display": "print(…)", "insert_text": "print("},
4+
]
5+
exclude=[
6+
{"insert_text": "print"},
7+
]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
signal test_signal
2+
3+
func _init() -> void:
4+
test_signal.connect(func(): p
5+
pass
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[output]
2+
include=[
3+
{"display": "print(…)", "insert_text": "print("},
4+
]
5+
exclude=[
6+
{"insert_text": "print"},
7+
]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
signal test_signal
2+
3+
func _init() -> void:
4+
test_signal.connect(func(a = p➡): pass
5+
pass

0 commit comments

Comments
 (0)