Index: pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart |
diff --git a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart |
index 332a7e85e1e81f96bc898465cf718a0b39a1ee36..0da2c8c1652cc8e69e924c34257f9c77ab7840cd 100644 |
--- a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart |
+++ b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart |
@@ -187,9 +187,13 @@ class _KeywordVisitor extends GeneralizingAstVisitor { |
@override |
visitForStatement(ForStatement node) { |
- if (entity == node.rightSeparator && entity.toString() != ';') { |
- // Handle the degenerate case while typing - for (int x i^) |
- _addSuggestion(Keyword.IN, DART_RELEVANCE_HIGH); |
+ // Handle the degenerate case while typing - for (int x i^) |
+ if (node.condition == entity && entity is SimpleIdentifier) { |
+ Token entityToken = (entity as SimpleIdentifier).beginToken; |
+ if (entityToken.previous.isSynthetic && |
+ entityToken.previous.type == TokenType.SEMICOLON) { |
+ _addSuggestion(Keyword.IN, DART_RELEVANCE_HIGH); |
+ } |
} |
} |