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

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

Issue 3006033002: Add completion of keywords in partial field declarations (Closed)
Patch Set: Created 3 years, 3 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/keyword_contributor.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
index 433ea389aebb916f58442e851f01ff0b9b157fbe..8803b5a2e97be8cf8481685d979fde735aac20f6 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
@@ -226,6 +226,25 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
}
@override
+ visitFieldDeclaration(FieldDeclaration node) {
+ VariableDeclarationList fields = node.fields;
+ NodeList<VariableDeclaration> variables = fields.variables;
+ if (variables.length != 1 ||
+ !variables[0].name.isSynthetic ||
+ fields.type == null) {
+ return;
+ }
+ if (entity != fields) {
+ return;
+ }
+ List<Keyword> keywords = <Keyword>[Keyword.CONST, Keyword.FINAL];
+ if (!node.isStatic) {
+ keywords.add(Keyword.STATIC);
+ }
+ _addSuggestions(keywords);
+ }
+
+ @override
visitForEachStatement(ForEachStatement node) {
if (entity == node.inKeyword) {
Token previous = node.inKeyword.previous;

Powered by Google App Engine
This is Rietveld 408576698