| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 @override | 57 @override |
| 58 Future<bool> computeFull(AstNode node) { | 58 Future<bool> computeFull(AstNode node) { |
| 59 if (node is SimpleIdentifier) { | 59 if (node is SimpleIdentifier) { |
| 60 node = node.parent; | 60 node = node.parent; |
| 61 } | 61 } |
| 62 if (node is MethodInvocation) { | 62 if (node is MethodInvocation) { |
| 63 node = (node as MethodInvocation).realTarget; | 63 node = (node as MethodInvocation).realTarget; |
| 64 } else if (node is PropertyAccess) { | 64 } else if (node is PropertyAccess) { |
| 65 node = (node as PropertyAccess).realTarget; | 65 node = (node as PropertyAccess).realTarget; |
| 66 } | 66 } |
| 67 if (node is Identifier && node.bestElement is ClassElement) { | 67 if (node is Identifier) { |
| 68 node.bestElement | 68 Element elem = node.bestElement; |
| 69 .accept(new _PrefixedIdentifierSuggestionBuilder(request)); | 69 if (elem is ClassElement || elem is PrefixElement) { |
| 70 return new Future.value(true); | 70 elem.accept(new _PrefixedIdentifierSuggestionBuilder(request)); |
| 71 return new Future.value(true); |
| 72 } |
| 71 } | 73 } |
| 72 if (node is Expression) { | 74 if (node is Expression) { |
| 73 InterfaceTypeSuggestionBuilder.suggestionsFor(request, node.bestType); | 75 InterfaceTypeSuggestionBuilder.suggestionsFor(request, node.bestType); |
| 74 return new Future.value(true); | 76 return new Future.value(true); |
| 75 } | 77 } |
| 76 return new Future.value(false); | 78 return new Future.value(false); |
| 77 } | 79 } |
| 78 } | 80 } |
| 79 | 81 |
| 80 /** | 82 /** |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if (directive.prefix.name == element.name) { | 323 if (directive.prefix.name == element.name) { |
| 322 // Suggest elements from the imported library | 324 // Suggest elements from the imported library |
| 323 LibraryElement library = directive.uriElement; | 325 LibraryElement library = directive.uriElement; |
| 324 LibraryElementSuggestionBuilder.suggestionsFor( | 326 LibraryElementSuggestionBuilder.suggestionsFor( |
| 325 request, CompletionSuggestionKind.INVOCATION, library); | 327 request, CompletionSuggestionKind.INVOCATION, library); |
| 326 modified = true; | 328 modified = true; |
| 327 } | 329 } |
| 328 } | 330 } |
| 329 } | 331 } |
| 330 } | 332 } |
| 331 ; | |
| 332 return new Future.value(modified); | 333 return new Future.value(modified); |
| 333 } | 334 } |
| 334 | 335 |
| 335 @override | 336 @override |
| 336 Future<bool> visitPropertyAccessorElement(PropertyAccessorElement element) { | 337 Future<bool> visitPropertyAccessorElement(PropertyAccessorElement element) { |
| 337 if (element != null) { | 338 if (element != null) { |
| 338 PropertyInducingElement elemVar = element.variable; | 339 PropertyInducingElement elemVar = element.variable; |
| 339 if (elemVar != null) { | 340 if (elemVar != null) { |
| 340 InterfaceTypeSuggestionBuilder.suggestionsFor(request, elemVar.type); | 341 InterfaceTypeSuggestionBuilder.suggestionsFor(request, elemVar.type); |
| 341 } | 342 } |
| 342 return new Future.value(true); | 343 return new Future.value(true); |
| 343 } | 344 } |
| 344 return new Future.value(false); | 345 return new Future.value(false); |
| 345 } | 346 } |
| 346 | 347 |
| 347 @override | 348 @override |
| 348 Future<bool> visitVariableElement(VariableElement element) { | 349 Future<bool> visitVariableElement(VariableElement element) { |
| 349 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); | 350 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); |
| 350 return new Future.value(true); | 351 return new Future.value(true); |
| 351 } | 352 } |
| 352 } | 353 } |
| OLD | NEW |