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

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

Issue 2397153004: Issue 27536. Quick Fix for 'Avoid using braces in interpolation when not needed'. (Closed)
Patch Set: Created 4 years, 2 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 f0e2c0a2ea8238fea80f5d5c9502787a88ec1ba4..39f96e73dcaf0b93c94927ac57fbe28b75bb913a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -365,6 +365,9 @@ class FixProcessor {
if (errorCode.name == LintNames.annotate_overrides) {
_addLintFixAddOverrideAnnotation();
}
+ if (errorCode.name == LintNames.unnecessary_brace_in_string_interp) {
+ _addLintRemoveInterpolationBraces();
+ }
}
// done
return fixes;
@@ -2289,6 +2292,18 @@ class FixProcessor {
_addFix(DartFixKind.LINT_ADD_OVERRIDE, []);
}
+ void _addLintRemoveInterpolationBraces() {
Brian Wilkerson 2016/10/07 18:57:56 Remove "Lint" from the name? I don't think it adds
+ AstNode node = this.node;
+ if (node is InterpolationExpression) {
+ Token right = node.rightBracket;
+ if (node.expression != null && right != null) {
+ _addReplaceEdit(rf.rangeStartStart(node, node.expression), r'$');
+ _addRemoveEdit(rf.rangeToken(right));
+ _addFix(DartFixKind.LINT_REMOVE_INTERPOLATION_BRACES, []);
+ }
+ }
+ }
+
/**
* Prepares proposal for creating function corresponding to the given
* [FunctionType].
@@ -2905,6 +2920,8 @@ class FixProcessor {
*/
class LintNames {
static const String annotate_overrides = 'annotate_overrides';
+ static const String unnecessary_brace_in_string_interp =
+ 'unnecessary_brace_in_string_interp';
}
/**
« 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