| 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..9c32f9f14b0dad568c2906e07a38e514b123e95b 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,22 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
| }
|
|
|
| @override
|
| + visitForEachStatement(ForEachStatement node) {
|
| + if (entity == node.inKeyword) {
|
| + Token previous = node.inKeyword.previous;
|
| + if (previous is SyntheticStringToken && previous.lexeme == 'in') {
|
| + previous = previous.previous;
|
| + }
|
| + if (previous != null && previous.type == TokenType.EQ) {
|
| + _addSuggestions(
|
| + [Keyword.FALSE, Keyword.NEW, Keyword.NULL, Keyword.TRUE]);
|
| + } else {
|
| + _addSuggestion(Keyword.IN, DART_RELEVANCE_HIGH);
|
| + }
|
| + }
|
| + }
|
| +
|
| + @override
|
| visitFormalParameterList(FormalParameterList node) {
|
| AstNode constructorDecl =
|
| node.getAncestor((p) => p is ConstructorDeclaration);
|
| @@ -166,6 +175,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 +277,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);
|
|
|