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

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

Issue 645733002: improve suggestions in for statement (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/test/services/completion/completion_test_util.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_server.dart' hide Element, 9 import 'package:analysis_server/src/protocol_server.dart' hide Element,
10 ElementKind; 10 ElementKind;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Expression expression = node.expression; 88 Expression expression = node.expression;
89 // A pre-variable declaration (e.g. C ^) is parsed as an expression 89 // A pre-variable declaration (e.g. C ^) is parsed as an expression
90 // statement. Do not make suggestions for the variable name. 90 // statement. Do not make suggestions for the variable name.
91 if (expression is SimpleIdentifier && request.offset <= expression.end) { 91 if (expression is SimpleIdentifier && request.offset <= expression.end) {
92 return _addImportedElementSuggestions(); 92 return _addImportedElementSuggestions();
93 } 93 }
94 return new Future.value(false); 94 return new Future.value(false);
95 } 95 }
96 96
97 @override 97 @override
98 Future<bool> visitForStatement(ForStatement node) {
99 Token leftParenthesis = node.leftParenthesis;
100 if (leftParenthesis != null && request.offset >= leftParenthesis.end) {
101 return _addImportedElementSuggestions();
102 }
103 return new Future.value(false);
104 }
105
106 @override
98 Future<bool> visitNode(AstNode node) { 107 Future<bool> visitNode(AstNode node) {
99 return new Future.value(false); 108 return new Future.value(false);
100 } 109 }
101 110
102 @override 111 @override
103 Future<bool> visitPrefixedIdentifier(PrefixedIdentifier node) { 112 Future<bool> visitPrefixedIdentifier(PrefixedIdentifier node) {
104 // Make suggestions for the prefix, but not for the selector 113 // Make suggestions for the prefix, but not for the selector
105 // InvocationComputer makes selector suggestions 114 // InvocationComputer makes selector suggestions
106 Token period = node.period; 115 Token period = node.period;
107 if (period != null && request.offset <= period.offset) { 116 if (period != null && request.offset <= period.offset) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 importElem.isDeprecated, 276 importElem.isDeprecated,
268 false); 277 false);
269 LibraryElement lib = importElem.importedLibrary; 278 LibraryElement lib = importElem.importedLibrary;
270 if (lib != null) { 279 if (lib != null) {
271 suggestion.element = newElement_fromEngine(lib); 280 suggestion.element = newElement_fromEngine(lib);
272 } 281 }
273 request.suggestions.add(suggestion); 282 request.suggestions.add(suggestion);
274 } 283 }
275 } 284 }
276 } 285 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/services/completion/completion_test_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698