Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1831)

Unified Diff: pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Issue 2377803002: Order suggested Quick Fix imports: direct, export, non-API. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/lib/src/services/correction/fix_internal.dart
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index a8945181a748953a4b169ffe0734a6fa75daff33..78939c562c35d2b1b414a09ecedb1bc469155f60 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1554,8 +1554,22 @@ class FixProcessor {
if (element.kind != kind) {
continue;
}
- _addFix_importLibrary(
- DartFixKind.IMPORT_LIBRARY_PROJECT, libraryElement);
+ // Compute the fix kind.
+ FixKind fixKind;
+ if (resourceProvider.pathContext
+ .split(librarySource.fullName)
+ .contains('src')) {
+ // Bad: non-API.
+ fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT3;
+ } else if (element.library != libraryElement) {
+ // Ugly: exports.
+ fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT2;
+ } else {
+ // Good: direct declaration.
+ fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT1;
+ }
+ // Add the fix.
+ _addFix_importLibrary(fixKind, libraryElement);
}
}
}
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix.dart ('k') | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698