| OLD | NEW |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Make suggestions for the target, but not for the selector | 57 // Make suggestions for the target, but not for the selector |
| 58 // InvocationComputer makes selector suggestions | 58 // InvocationComputer makes selector suggestions |
| 59 Expression target = node.target; | 59 Expression target = node.target; |
| 60 if (target != null && request.offset <= target.end) { | 60 if (target != null && request.offset <= target.end) { |
| 61 return _addImportedElementSuggestions(); | 61 return _addImportedElementSuggestions(); |
| 62 } | 62 } |
| 63 return new Future.value(false); | 63 return new Future.value(false); |
| 64 } | 64 } |
| 65 | 65 |
| 66 @override | 66 @override |
| 67 Future<bool> visitClassDeclaration(ClassDeclaration node) { |
| 68 // Make suggestions in the body of the class declaration |
| 69 Token leftBracket = node.leftBracket; |
| 70 if (leftBracket != null && request.offset >= leftBracket.end) { |
| 71 return _addImportedElementSuggestions(); |
| 72 } |
| 73 return new Future.value(false); |
| 74 } |
| 75 |
| 76 @override |
| 67 Future<bool> visitCombinator(Combinator node) { | 77 Future<bool> visitCombinator(Combinator node) { |
| 68 return _addCombinatorSuggestions(node); | 78 return _addCombinatorSuggestions(node); |
| 69 } | 79 } |
| 70 | 80 |
| 71 @override | 81 @override |
| 72 Future<bool> visitExpression(Expression node) { | 82 Future<bool> visitExpression(Expression node) { |
| 73 return _addImportedElementSuggestions(); | 83 return _addImportedElementSuggestions(); |
| 74 } | 84 } |
| 75 | 85 |
| 76 @override | 86 @override |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 importElem.isDeprecated, | 267 importElem.isDeprecated, |
| 258 false); | 268 false); |
| 259 LibraryElement lib = importElem.importedLibrary; | 269 LibraryElement lib = importElem.importedLibrary; |
| 260 if (lib != null) { | 270 if (lib != null) { |
| 261 suggestion.element = newElement_fromEngine(lib); | 271 suggestion.element = newElement_fromEngine(lib); |
| 262 } | 272 } |
| 263 request.suggestions.add(suggestion); | 273 request.suggestions.add(suggestion); |
| 264 } | 274 } |
| 265 } | 275 } |
| 266 } | 276 } |
| OLD | NEW |