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

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart

Issue 2128693002: fix code completion when enableTrailingCommas is true (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 4 years, 5 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/completion/dart/arglist_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart
index 32f9e8e58dcfb63b20bb376f2632c7ba91c9b6f1..102cd90be2b36799c70e1995bb703f7236c2daae 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart
@@ -19,6 +19,12 @@ import 'package:analyzer/src/generated/utilities_dart.dart';
int _argCount(DartCompletionRequest request) {
AstNode node = request.target.containingNode;
if (node is ArgumentList) {
+ if (request.target.entity == node.rightParenthesis) {
+ // Parser ignores trailing commas
+ if (node.rightParenthesis.previous?.lexeme == ',') {
+ return node.arguments.length + 1;
+ }
+ }
return node.arguments.length;
}
return 0;

Powered by Google App Engine
This is Rietveld 408576698