| Index: pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
|
| index 9199091a64b36e570f34386420a8f23112a61bf3..9d14fda53cbe1282b455ed2792de43cae6de7561 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
|
| @@ -46,7 +46,20 @@ class LocalReferenceContributor extends DartCompletionContributor {
|
| optype.includeVoidReturnSuggestions) {
|
| _LocalVisitor visitor =
|
| new _LocalVisitor(request, request.offset, optype);
|
| - visitor.visit(request.target.containingNode);
|
| + AstNode node = request.target.containingNode;
|
| +
|
| + // Do not suggest local vars within the current expression
|
| + while (node is Expression) {
|
| + node = node.parent;
|
| + }
|
| +
|
| + // Do not suggest loop variable of a ForEachStatement
|
| + // when completing the expression of the ForEachStatement
|
| + if (node is ForEachStatement) {
|
| + node = node.parent;
|
| + }
|
| +
|
| + visitor.visit(node);
|
| return visitor.suggestions;
|
| }
|
| }
|
|
|