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 {