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

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

Issue 2864373003: Add trailing commas after Flutter instance creation params fixes (flutter-intellij/#f978). (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 15119852ffc8b3714d1bc49716fa0d0ed1e35c9c..8064e8b45a5872706ddd88807322f501fc947555 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -640,7 +640,13 @@ class FixProcessor {
ParameterElement element =
parameters.firstWhere((p) => p.name == paramName, orElse: () => null);
String defaultValue = getDefaultStringParameterValue(element);
- sb.append('$paramName: $defaultValue'); // TODO(pq): add trailing comma
+ sb.append('$paramName: $defaultValue');
+
+ // Insert a trailing comma after Flutter instance creation params.
+ InstanceCreationExpression newExpr = identifyNewExpression(node);
+ if (newExpr != null && isFlutterInstanceCreationExpression(newExpr)) {
+ sb.append(',');
+ }
_insertBuilder(sb, null);
_addFix(DartFixKind.ADD_MISSING_REQUIRED_ARGUMENT, [paramName]);
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/correction/fix_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698