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

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

Issue 1736383002: Quick-fix for `annotate_overrides` lint (#25416). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rev_fixes Created 4 years, 10 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 01ddada39915dd611ead32c365ee63f8dd586749..78fb2c427ed67076278948f3d86ddb0c338a513a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -343,6 +343,12 @@ class FixProcessor {
_addFix_undefinedClassAccessor_useSimilar();
_addFix_createField();
}
+ // lints
+ if (errorCode is LintCode) {
+ if (errorCode.name == LintNames.annotate_overrides) {
+ _addLintFixAddOverrideAnnotation();
+ }
+ }
// done
return fixes;
}
@@ -2202,6 +2208,17 @@ class FixProcessor {
group.addPosition(position, range.length);
}
+ void _addLintFixAddOverrideAnnotation() {
+ ClassMember member = node.getAncestor((n) => n is ClassMember);
+ if (member == null) {
+ return;
+ }
+ exitPosition = new Position(file, member.offset - 1);
+ String indent = utils.getIndent(1);
+ _addReplaceEdit(rf.rangeStartLength(member, 0), '@override$eol$indent');
+ _addFix(DartFixKind.LINT_ADD_OVERRIDE, []);
+ }
+
/**
* Prepares proposal for creating function corresponding to the given
* [FunctionType].
@@ -2884,6 +2901,13 @@ class FixProcessor {
}
/**
+ * An enumeration of lint names.
+ */
+class LintNames {
+ static const String annotate_overrides = 'annotate_overrides';
+}
+
+/**
* Helper for finding [Element] with name closest to the given.
*/
class _ClosestElementFinder {

Powered by Google App Engine
This is Rietveld 408576698