diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart index b9616861404..86b908403da 100644 --- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart +++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart @@ -447,6 +447,8 @@ class AssistProcessor { classDeclaration.leftBracket), (DartEditBuilder builder) { builder.write('mixin '); builder.write(classDeclaration.name.name); + builder.writeTypeParameters( + classDeclaration.declaredElement.typeParameters); builder.writeTypes(superclassConstraints, prefix: ' on '); builder.writeTypes(interfaces, prefix: ' implements '); builder.write(' '); diff --git a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart index ce8a4d3069c..d2dd2427da5 100644 --- a/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart +++ b/pkg/analysis_server/test/src/services/correction/assist/convert_class_to_mixin_test.dart @@ -373,6 +373,15 @@ mixin A {} '''); } + test_typeParameters() async { + await resolveTestUnit(''' +class A {} +'''); + await assertHasAssistAt('A', ''' +mixin A {} +'''); + } + test_with_noSuper() async { await resolveTestUnit(''' class A {}