Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/imported_computer.dart

Issue 626303002: filter undesired suggestions from prefix expression (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/local_computer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library services.completion.computer.dart.toplevel; 5 library services.completion.computer.dart.toplevel;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element,
10 ElementKind; 10 ElementKind;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 @override 60 @override
61 Future<bool> visitSimpleIdentifier(SimpleIdentifier node) { 61 Future<bool> visitSimpleIdentifier(SimpleIdentifier node) {
62 AstNode parent = node.parent; 62 AstNode parent = node.parent;
63 if (parent is Combinator) { 63 if (parent is Combinator) {
64 return _addCombinatorSuggestions(parent); 64 return _addCombinatorSuggestions(parent);
65 } 65 }
66 if (parent is ExpressionStatement) { 66 if (parent is ExpressionStatement) {
67 return _addImportedElementSuggestions(); 67 return _addImportedElementSuggestions();
68 } 68 }
69 if (parent is PrefixedIdentifier) {
70 if (request.offset <= parent.prefix.end) {
71 return _addImportedElementSuggestions();
72 }
73 }
69 return new Future.value(false); 74 return new Future.value(false);
70 } 75 }
71 76
72 Future _addCombinatorSuggestions(Combinator node) { 77 Future _addCombinatorSuggestions(Combinator node) {
73 var directive = node.getAncestor((parent) => parent is NamespaceDirective); 78 var directive = node.getAncestor((parent) => parent is NamespaceDirective);
74 if (directive is NamespaceDirective) { 79 if (directive is NamespaceDirective) {
75 LibraryElement library = directive.uriElement; 80 LibraryElement library = directive.uriElement;
76 LibraryElementSuggestionBuilder.suggestionsFor(request, library); 81 LibraryElementSuggestionBuilder.suggestionsFor(request, library);
77 return new Future.value(true); 82 return new Future.value(true);
78 } 83 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 importElem.isDeprecated, 189 importElem.isDeprecated,
185 false); 190 false);
186 LibraryElement lib = importElem.importedLibrary; 191 LibraryElement lib = importElem.importedLibrary;
187 if (lib != null) { 192 if (lib != null) {
188 suggestion.element = new protocol.Element.fromEngine(lib); 193 suggestion.element = new protocol.Element.fromEngine(lib);
189 } 194 }
190 request.suggestions.add(suggestion); 195 request.suggestions.add(suggestion);
191 } 196 }
192 } 197 }
193 } 198 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/local_computer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698