| 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.invocation; | 5 library services.completion.computer.dart.invocation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 10 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; | 10 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 //TODO (danrubel) reimplement to use prefixElement.importedLibraries | 316 //TODO (danrubel) reimplement to use prefixElement.importedLibraries |
| 317 // once that accessor is implemented and available in Dart | 317 // once that accessor is implemented and available in Dart |
| 318 bool modified = false; | 318 bool modified = false; |
| 319 // Find the import directive with the given prefix | 319 // Find the import directive with the given prefix |
| 320 for (Directive directive in request.unit.directives) { | 320 for (Directive directive in request.unit.directives) { |
| 321 if (directive is ImportDirective) { | 321 if (directive is ImportDirective) { |
| 322 if (directive.prefix != null) { | 322 if (directive.prefix != null) { |
| 323 if (directive.prefix.name == element.name) { | 323 if (directive.prefix.name == element.name) { |
| 324 // Suggest elements from the imported library | 324 // Suggest elements from the imported library |
| 325 LibraryElement library = directive.uriElement; | 325 LibraryElement library = directive.uriElement; |
| 326 LibraryElementSuggestionBuilder.suggestionsFor( | 326 LibraryElementSuggestionBuilder.suggestionsFor(request, |
| 327 request, CompletionSuggestionKind.INVOCATION, library); | 327 CompletionSuggestionKind.INVOCATION, library, |
| 328 request.target.containingNode.parent is TypeName); |
| 328 modified = true; | 329 modified = true; |
| 329 } | 330 } |
| 330 } | 331 } |
| 331 } | 332 } |
| 332 } | 333 } |
| 333 return new Future.value(modified); | 334 return new Future.value(modified); |
| 334 } | 335 } |
| 335 | 336 |
| 336 @override | 337 @override |
| 337 Future<bool> visitPropertyAccessorElement(PropertyAccessorElement element) { | 338 Future<bool> visitPropertyAccessorElement(PropertyAccessorElement element) { |
| 338 if (element != null) { | 339 if (element != null) { |
| 339 PropertyInducingElement elemVar = element.variable; | 340 PropertyInducingElement elemVar = element.variable; |
| 340 if (elemVar != null) { | 341 if (elemVar != null) { |
| 341 InterfaceTypeSuggestionBuilder.suggestionsFor(request, elemVar.type); | 342 InterfaceTypeSuggestionBuilder.suggestionsFor(request, elemVar.type); |
| 342 } | 343 } |
| 343 return new Future.value(true); | 344 return new Future.value(true); |
| 344 } | 345 } |
| 345 return new Future.value(false); | 346 return new Future.value(false); |
| 346 } | 347 } |
| 347 | 348 |
| 348 @override | 349 @override |
| 349 Future<bool> visitVariableElement(VariableElement element) { | 350 Future<bool> visitVariableElement(VariableElement element) { |
| 350 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); | 351 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); |
| 351 return new Future.value(true); | 352 return new Future.value(true); |
| 352 } | 353 } |
| 353 } | 354 } |
| OLD | NEW |