| 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.contributor.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'; |
| 11 import 'package:analysis_server/src/services/completion/optype.dart'; | 11 import 'package:analysis_server/src/services/completion/optype.dart'; |
| 12 import 'package:analysis_server/src/services/completion/suggestion_builder.dart'
; | 12 import 'package:analysis_server/src/services/completion/suggestion_builder.dart'
; |
| 13 import 'package:analyzer/src/generated/ast.dart'; | 13 import 'package:analyzer/src/generated/ast.dart'; |
| 14 import 'package:analyzer/src/generated/element.dart'; | 14 import 'package:analyzer/src/generated/element.dart'; |
| 15 | 15 |
| 16 import '../../protocol_server.dart' show CompletionSuggestionKind; | 16 import '../../protocol_server.dart' show CompletionSuggestionKind; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * A computer for calculating invocation / access suggestions | 19 * A contributor for calculating invocation / access suggestions |
| 20 * `completion.getSuggestions` request results. | 20 * `completion.getSuggestions` request results. |
| 21 */ | 21 */ |
| 22 class InvocationComputer extends DartCompletionComputer { | 22 class PrefixedElementContributor extends DartCompletionContributor { |
| 23 SuggestionBuilder builder; | 23 SuggestionBuilder builder; |
| 24 | 24 |
| 25 @override | 25 @override |
| 26 bool computeFast(DartCompletionRequest request) { | 26 bool computeFast(DartCompletionRequest request) { |
| 27 OpType optype = request.optype; | 27 OpType optype = request.optype; |
| 28 if (optype.includeInvocationSuggestions) { | 28 if (optype.includeInvocationSuggestions) { |
| 29 builder = request.target.containingNode | 29 builder = request.target.containingNode |
| 30 .accept(new _InvocationAstVisitor(request)); | 30 .accept(new _InvocationAstVisitor(request)); |
| 31 if (builder != null) { | 31 if (builder != null) { |
| 32 return builder.computeFast(request.target.containingNode); | 32 return builder.computeFast(request.target.containingNode); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 335 } |
| 336 return new Future.value(false); | 336 return new Future.value(false); |
| 337 } | 337 } |
| 338 | 338 |
| 339 @override | 339 @override |
| 340 Future<bool> visitVariableElement(VariableElement element) { | 340 Future<bool> visitVariableElement(VariableElement element) { |
| 341 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); | 341 InterfaceTypeSuggestionBuilder.suggestionsFor(request, element.type); |
| 342 return new Future.value(true); | 342 return new Future.value(true); |
| 343 } | 343 } |
| 344 } | 344 } |
| OLD | NEW |