| Index: pkg/analysis_server/lib/src/services/completion/local_computer.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/local_computer.dart b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
|
| index 90a590842d571a8f3e61a9fbfb0e85150bbd8d45..082260d4910f0af36626faa9deac0ef0ec8e7a7f 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/local_computer.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/local_computer.dart
|
| @@ -116,41 +116,6 @@ class _LocalVisitor extends LocalDeclarationVisitor {
|
| }
|
|
|
| @override
|
| - bool visitCascadeExpression(CascadeExpression node) {
|
| - Expression target = node.target;
|
| - // This computer handles the expression
|
| - // while InvocationComputer handles the cascade selector
|
| - if (target != null && offset <= target.end) {
|
| - return visitNode(node);
|
| - } else {
|
| - return finished;
|
| - }
|
| - }
|
| -
|
| - @override
|
| - bool visitNamespaceDirective(NamespaceDirective node) {
|
| - // No suggestions
|
| - return finished;
|
| - }
|
| -
|
| - @override
|
| - bool visitStringLiteral(StringLiteral node) {
|
| - // ignore
|
| - return finished;
|
| - }
|
| -
|
| - @override
|
| - bool visitVariableDeclaration(VariableDeclaration node) {
|
| - // Do not add suggestions if editing the name in a var declaration
|
| - SimpleIdentifier name = node.name;
|
| - if (name == null || name.offset < offset || offset > name.end) {
|
| - return visitNode(node);
|
| - } else {
|
| - return finished;
|
| - }
|
| - }
|
| -
|
| - @override
|
| void declaredFunction(FunctionDeclaration declaration) {
|
| if (typesOnly) {
|
| return;
|
| @@ -284,6 +249,18 @@ class _LocalVisitor extends LocalDeclarationVisitor {
|
| }
|
|
|
| @override
|
| + bool visitCascadeExpression(CascadeExpression node) {
|
| + Expression target = node.target;
|
| + // This computer handles the expression
|
| + // while InvocationComputer handles the cascade selector
|
| + if (target != null && offset <= target.end) {
|
| + return visitNode(node);
|
| + } else {
|
| + return finished;
|
| + }
|
| + }
|
| +
|
| + @override
|
| visitCombinator(Combinator node) {
|
| // Handled by CombinatorComputer
|
| }
|
| @@ -302,6 +279,12 @@ class _LocalVisitor extends LocalDeclarationVisitor {
|
| }
|
|
|
| @override
|
| + bool visitNamespaceDirective(NamespaceDirective node) {
|
| + // No suggestions
|
| + return finished;
|
| + }
|
| +
|
| + @override
|
| visitPrefixedIdentifier(PrefixedIdentifier node) {
|
| // InvocationComputer adds suggestions for prefixed elements
|
| // but this computer adds suggestions for the prefix itself
|
| @@ -317,6 +300,12 @@ class _LocalVisitor extends LocalDeclarationVisitor {
|
| }
|
|
|
| @override
|
| + bool visitStringLiteral(StringLiteral node) {
|
| + // ignore
|
| + return finished;
|
| + }
|
| +
|
| + @override
|
| visitTypeName(TypeName node) {
|
| // If suggesting completions within a TypeName node
|
| // then limit suggestions to only types
|
| @@ -324,6 +313,17 @@ class _LocalVisitor extends LocalDeclarationVisitor {
|
| return visitNode(node);
|
| }
|
|
|
| + @override
|
| + bool visitVariableDeclaration(VariableDeclaration node) {
|
| + // Do not add suggestions if editing the name in a var declaration
|
| + SimpleIdentifier name = node.name;
|
| + if (name == null || name.offset < offset || offset > name.end) {
|
| + return visitNode(node);
|
| + } else {
|
| + return finished;
|
| + }
|
| + }
|
| +
|
| CompletionSuggestion _addSuggestion(SimpleIdentifier id, TypeName typeName,
|
| ClassDeclaration classDecl, bool isDeprecated) {
|
| if (id != null) {
|
|
|