From 33fcfbf3ab956890ef75234796f519e705bfecda Mon Sep 17 00:00:00 2001 From: Fedor Shcheglov Date: Mon, 27 Oct 2025 20:46:32 -0700 Subject: [PATCH] Implement DotShorthandConstructorInvocationImpl support for argument list context. Bug: https://github.com/dart-lang/sdk/issues/61843 Change-Id: I54118ea6599c30e36918dd3255f6c79b2f02280e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/457801 Reviewed-by: Konstantin Shcheglov Reviewed-by: Samuel Rawlins Commit-Queue: Konstantin Shcheglov --- .../lib/src/utilities/completion/optype.dart | 2 ++ .../src/utilities/completion/optype_test.dart | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart index 6e2aca23817..6363a495460 100644 --- a/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart +++ b/pkg/analyzer_plugin/lib/src/utilities/completion/optype.dart @@ -1837,6 +1837,8 @@ class _OpTypeAstVisitor extends GeneralizingAstVisitor { var parent = node.parent; if (parent is Annotation) { return 'annotation'; + } else if (parent is DotShorthandConstructorInvocation) { + return 'constructor'; } else if (parent is EnumConstantArguments) { return 'enumConstantArguments'; } else if (parent is ExtensionOverride) { diff --git a/pkg/analyzer_plugin/test/src/utilities/completion/optype_test.dart b/pkg/analyzer_plugin/test/src/utilities/completion/optype_test.dart index 9293b2b4822..f6ebf64ddbc 100644 --- a/pkg/analyzer_plugin/test/src/utilities/completion/optype_test.dart +++ b/pkg/analyzer_plugin/test/src/utilities/completion/optype_test.dart @@ -1131,6 +1131,21 @@ void f() { ); } + Future test_dotShorthandConstructorInvocation_arguments() async { + addTestSource(''' +class C { + C({int? i}); +} +void f() { + C _ = .new(^); +}, +'''); + await assertOpType( + completionLocation: 'ArgumentList_constructor_named', + namedArgs: true, + ); + } + Future test_dotShorthandConstructorInvocation_noTarget() async { addTestSource(''' class C {