diff --git a/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart index a9b82cb028fb..ae23d409bdbe 100644 --- a/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart +++ b/pkg/analysis_server/lib/src/services/correction/dart/import_library.dart @@ -377,6 +377,7 @@ class ImportLibrary extends MultiCorrectionProducer { return await _importLibraryForElement(typeName, const [ ElementKind.CLASS, ElementKind.ENUM, + ElementKind.EXTENSION_TYPE, ElementKind.FUNCTION_TYPE_ALIAS, ElementKind.MIXIN, ElementKind.TYPE_ALIAS, diff --git a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart index 93524dd9e366..ec1f1798e447 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart @@ -305,6 +305,22 @@ void f() { '''); } + Future test_extensionType_name_notImported() async { + newFile('$testPackageLibPath/lib.dart', ''' +extension type ET(String it) {} +'''); + await resolveTestCode(''' +void f(ET s) { +} +'''); + await assertHasFix(''' +import 'package:test/lib.dart'; + +void f(ET s) { +} +'''); + } + Future test_extensionType_notImported() async { newFile('$testPackageLibPath/lib.dart', ''' extension type ET(String it) {}