| 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.local; | 5 library services.completion.contributor.dart.local; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' as protocol | 9 import 'package:analysis_server/src/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| 11 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; | 11 import 'package:analysis_server/src/protocol.dart' hide Element, ElementKind; |
| 12 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 12 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 13 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; | 13 import 'package:analysis_server/src/services/completion/local_declaration_visito
r.dart'; |
| 14 import 'package:analysis_server/src/services/completion/optype.dart'; | 14 import 'package:analysis_server/src/services/completion/optype.dart'; |
| 15 import 'package:analyzer/src/generated/ast.dart'; | 15 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return _DYNAMIC; | 70 return _DYNAMIC; |
| 71 } | 71 } |
| 72 TypeArgumentList typeArgs = type.typeArguments; | 72 TypeArgumentList typeArgs = type.typeArguments; |
| 73 if (typeArgs != null) { | 73 if (typeArgs != null) { |
| 74 //TODO (danrubel) include type arguments | 74 //TODO (danrubel) include type arguments |
| 75 } | 75 } |
| 76 return name; | 76 return name; |
| 77 } | 77 } |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * A computer for calculating `completion.getSuggestions` request results | 80 * A contributor for calculating `completion.getSuggestions` request results |
| 81 * for the local library in which the completion is requested. | 81 * for the local library in which the completion is requested. |
| 82 */ | 82 */ |
| 83 class LocalComputer extends DartCompletionComputer { | 83 class LocalReferenceContributor extends DartCompletionContributor { |
| 84 @override | 84 @override |
| 85 bool computeFast(DartCompletionRequest request) { | 85 bool computeFast(DartCompletionRequest request) { |
| 86 OpType optype = request.optype; | 86 OpType optype = request.optype; |
| 87 | 87 |
| 88 // Collect suggestions from the specific child [AstNode] that contains | 88 // Collect suggestions from the specific child [AstNode] that contains |
| 89 // the completion offset and all of its parents recursively. | 89 // the completion offset and all of its parents recursively. |
| 90 if (optype.includeReturnValueSuggestions || | 90 if (optype.includeReturnValueSuggestions || |
| 91 optype.includeTypeNameSuggestions || | 91 optype.includeTypeNameSuggestions || |
| 92 optype.includeVoidReturnSuggestions) { | 92 optype.includeVoidReturnSuggestions) { |
| 93 _LocalVisitor localVisitor = | 93 _LocalVisitor localVisitor = |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 bool _isVoid(TypeName returnType) { | 691 bool _isVoid(TypeName returnType) { |
| 692 if (returnType != null) { | 692 if (returnType != null) { |
| 693 Identifier id = returnType.name; | 693 Identifier id = returnType.name; |
| 694 if (id != null && id.name == 'void') { | 694 if (id != null && id.name == 'void') { |
| 695 return true; | 695 return true; |
| 696 } | 696 } |
| 697 } | 697 } |
| 698 return false; | 698 return false; |
| 699 } | 699 } |
| 700 } | 700 } |
| OLD | NEW |