| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.dart.manager; | 5 library services.completion.dart.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' | 10 import 'package:analysis_server/src/provisional/completion/completion_core.dart' |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Adjust suggestion relevance before returning | 81 // Adjust suggestion relevance before returning |
| 82 List<CompletionSuggestion> suggestions = suggestionMap.values.toList(); | 82 List<CompletionSuggestion> suggestions = suggestionMap.values.toList(); |
| 83 await contributionSorter.sort(dartRequest, suggestions); | 83 await contributionSorter.sort(dartRequest, suggestions); |
| 84 return suggestions; | 84 return suggestions; |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 /** | 88 /** |
| 89 * The information about a requested list of completions within a Dart file. | 89 * The information about a requested list of completions within a Dart file. |
| 90 */ | 90 */ |
| 91 class DartCompletionRequestImpl extends CompletionRequestImpl | 91 class DartCompletionRequestImpl implements DartCompletionRequest { |
| 92 implements DartCompletionRequest { | 92 @override |
| 93 /** | 93 final AnalysisContext context; |
| 94 * The [LibraryElement] representing dart:core | |
| 95 */ | |
| 96 LibraryElement _coreLib; | |
| 97 | 94 |
| 98 /** | 95 @override |
| 99 * The [DartType] for Object in dart:core | 96 final Source source; |
| 100 */ | 97 |
| 101 InterfaceType _objectType; | 98 @override |
| 99 final int offset; |
| 102 | 100 |
| 103 @override | 101 @override |
| 104 Expression dotTarget; | 102 Expression dotTarget; |
| 105 | 103 |
| 106 @override | 104 @override |
| 107 Source librarySource; | 105 Source librarySource; |
| 108 | 106 |
| 109 OpType _opType; | 107 @override |
| 108 final ResourceProvider resourceProvider; |
| 109 |
| 110 @override |
| 111 final SearchEngine searchEngine; |
| 110 | 112 |
| 111 @override | 113 @override |
| 112 CompletionTarget target; | 114 CompletionTarget target; |
| 113 | 115 |
| 116 /** |
| 117 * The [LibraryElement] representing dart:core |
| 118 */ |
| 119 LibraryElement _coreLib; |
| 120 |
| 121 /** |
| 122 * The [DartType] for Object in dart:core |
| 123 */ |
| 124 InterfaceType _objectType; |
| 125 |
| 126 OpType _opType; |
| 127 |
| 114 DartCompletionRequestImpl._( | 128 DartCompletionRequestImpl._( |
| 115 AnalysisContext context, | 129 this.context, |
| 116 ResourceProvider resourceProvider, | 130 this.resourceProvider, |
| 117 SearchEngine searchEngine, | 131 this.searchEngine, |
| 118 this.librarySource, | 132 this.librarySource, |
| 119 Source source, | 133 this.source, |
| 120 int offset, | 134 this.offset, |
| 121 CompilationUnit unit) | 135 CompilationUnit unit) { |
| 122 : super(context, resourceProvider, searchEngine, source, offset) { | |
| 123 _updateTargets(unit); | 136 _updateTargets(unit); |
| 124 } | 137 } |
| 125 | 138 |
| 126 @override | 139 @override |
| 127 LibraryElement get coreLib { | 140 LibraryElement get coreLib { |
| 128 if (_coreLib == null) { | 141 if (_coreLib == null) { |
| 129 Source coreUri = context.sourceFactory.forUri('dart:core'); | 142 Source coreUri = context.sourceFactory.forUri('dart:core'); |
| 130 _coreLib = context.computeLibraryElement(coreUri); | 143 _coreLib = context.computeLibraryElement(coreUri); |
| 131 } | 144 } |
| 132 return _coreLib; | 145 return _coreLib; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // Replacement range for import URI | 360 // Replacement range for import URI |
| 348 return new ReplacementRange(start, end - start); | 361 return new ReplacementRange(start, end - start); |
| 349 } | 362 } |
| 350 } | 363 } |
| 351 } | 364 } |
| 352 } | 365 } |
| 353 } | 366 } |
| 354 return new ReplacementRange(requestOffset, 0); | 367 return new ReplacementRange(requestOffset, 0); |
| 355 } | 368 } |
| 356 } | 369 } |
| OLD | NEW |