Skip to content

Commit

Permalink
Fixed _writeSuperMemberInvocation in DartEditBuilderImpl to properly …
Browse files Browse the repository at this point in the history
…suggest completions when super member has named parameters

Closes #55697

GitOrigin-RevId: 8a43d85
Change-Id: I393b17fc26eda821615f2d2d29cb386ab5f98406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366081
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
  • Loading branch information
Devenik7 authored and Commit Queue committed May 14, 2024
1 parent b06a34f commit c37cccc
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,58 @@ suggestions
''');
}

Future<void> test_class_method_with_namedParameters() async {
await computeSuggestions('''
class A {
void foo01(int a, int b, { int? c, int? d }) {}
}
class B extends A {
foo^
}
''');

assertResponse(r'''
replacement
left: 3
suggestions
@override
void foo01(int a, int b, {int? c, int? d}) {
// TODO: implement foo01
super.foo01(a, b, c: c, d: d);
}
kind: override
displayText: foo01(int a, int b, {int? c, int? d}) { … }
selection: 90 30
''');
}

Future<void> test_class_method_without_namedParameters() async {
await computeSuggestions('''
class A {
void foo01(int a, int b) {}
}
class B extends A {
foo^
}
''');

assertResponse(r'''
replacement
left: 3
suggestions
@override
void foo01(int a, int b) {
// TODO: implement foo01
super.foo01(a, b);
}
kind: override
displayText: foo01(int a, int b) { … }
selection: 72 18
''');
}

Future<void> test_class_operator_eqEq() async {
await computeSuggestions('''
class A {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1162,6 +1162,10 @@ class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder {
if (i > 0) {
write(', ');
}
if (parameters[i].isNamed) {
write(parameters[i].name);
write(': ');
}
write(parameters[i].name);
}
write(isOperator ? ';' : ');');
Expand Down

0 comments on commit c37cccc

Please sign in to comment.