| Index: pkg/analysis_services/lib/src/completion/imported_type_computer.dart
|
| diff --git a/pkg/analysis_services/lib/src/completion/imported_type_computer.dart b/pkg/analysis_services/lib/src/completion/imported_type_computer.dart
|
| index 959f4b4effab062a17732f3b56274a2be65172d9..29514156c8fa412335141e4a8f512744800c3d36 100644
|
| --- a/pkg/analysis_services/lib/src/completion/imported_type_computer.dart
|
| +++ b/pkg/analysis_services/lib/src/completion/imported_type_computer.dart
|
| @@ -32,7 +32,7 @@ class ImportedTypeComputer extends CompletionComputer {
|
| Future<bool> computeFull(CompilationUnit unit, AstNode node,
|
| List<CompletionSuggestion> suggestions) {
|
| return node.accept(
|
| - new _ImportedTypeVisitor(searchEngine, unit, suggestions));
|
| + new _ImportedTypeVisitor(searchEngine, unit, offset, suggestions));
|
| }
|
| }
|
|
|
| @@ -43,9 +43,11 @@ class ImportedTypeComputer extends CompletionComputer {
|
| class _ImportedTypeVisitor extends GeneralizingAstVisitor<Future<bool>> {
|
| final SearchEngine searchEngine;
|
| final CompilationUnit unit;
|
| + final int offset;
|
| final List<CompletionSuggestion> suggestions;
|
|
|
| - _ImportedTypeVisitor(this.searchEngine, this.unit, this.suggestions);
|
| + _ImportedTypeVisitor(this.searchEngine, this.unit, this.offset,
|
| + this.suggestions);
|
|
|
| Future<bool> visitCombinator(Combinator node) {
|
| var directive = node.getAncestor((parent) => parent is NamespaceDirective);
|
| @@ -63,6 +65,15 @@ class _ImportedTypeVisitor extends GeneralizingAstVisitor<Future<bool>> {
|
| return node.parent.accept(this);
|
| }
|
|
|
| + Future<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);
|
| + }
|
| + return new Future.value(false);
|
| + }
|
| +
|
| Future<bool> _addImportedElements() {
|
| var future = searchEngine.searchTopLevelDeclarations('');
|
| return future.then((List<SearchMatch> matches) {
|
|
|