| 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 94598dbe051e8e6ff49ddfdbe160a188c28a9bab..8da4aa5247043ba96fe5f866b7b820d00c7c4fc8 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart
|
| @@ -124,7 +124,8 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
| !node.directives.any((d) => d is LibraryDirective)) {
|
| _addSuggestions([Keyword.LIBRARY], DART_RELEVANCE_HIGH);
|
| }
|
| - _addSuggestions([Keyword.IMPORT, Keyword.EXPORT, Keyword.PART], DART_RELEVANCE_HIGH);
|
| + _addSuggestions(
|
| + [Keyword.IMPORT, Keyword.EXPORT, Keyword.PART], DART_RELEVANCE_HIGH);
|
| }
|
| if (entity == null || entity is Declaration) {
|
| if (previousMember is FunctionDeclaration &&
|
| @@ -137,14 +138,6 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
| }
|
|
|
| @override
|
| - visitPropertyAccess(PropertyAccess node) {
|
| - // suggestions before '.' but not after
|
| - if (entity != node.propertyName) {
|
| - super.visitPropertyAccess(node);
|
| - }
|
| - }
|
| -
|
| - @override
|
| visitExpression(Expression node) {
|
| _addExpressionKeywords(node);
|
| }
|
| @@ -157,6 +150,13 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
| }
|
|
|
| @override
|
| + visitForEachStatement(ForEachStatement node) {
|
| + if (entity == node.inKeyword) {
|
| + _addSuggestion(Keyword.IN, DART_RELEVANCE_HIGH);
|
| + }
|
| + }
|
| +
|
| + @override
|
| visitFormalParameterList(FormalParameterList node) {
|
| AstNode constructorDecl =
|
| node.getAncestor((p) => p is ConstructorDeclaration);
|
| @@ -166,6 +166,14 @@ 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);
|
| + }
|
| + }
|
| +
|
| + @override
|
| visitFunctionExpression(FunctionExpression node) {
|
| if (entity == node.body) {
|
| if (!node.body.isAsynchronous) {
|
| @@ -260,6 +268,14 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
| }
|
|
|
| @override
|
| + visitPropertyAccess(PropertyAccess node) {
|
| + // suggestions before '.' but not after
|
| + if (entity != node.propertyName) {
|
| + super.visitPropertyAccess(node);
|
| + }
|
| + }
|
| +
|
| + @override
|
| visitReturnStatement(ReturnStatement node) {
|
| if (entity == node.expression) {
|
| _addExpressionKeywords(node);
|
|
|