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

Unified Diff: pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
diff --git a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
index bbf9cb5ba7050b300e97c35691b283c15b63b15d..7e7ae5cb97189d10d70c5ef170eea38fe99f44e2 100644
--- a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
+++ b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
@@ -22,6 +22,13 @@ int _computeArgIndex(AstNode containingNode, Object entity) {
if (args.isEmpty) {
return 0;
}
+ if (entity == argList.rightParenthesis) {
+ // Parser ignores trailing commas
+ if (argList.rightParenthesis.previous?.lexeme == ',') {
+ return args.length;
+ }
+ return args.length - 1;
+ }
}
return null;
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/dart/arglist_contributor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698