| 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.dart; | 5 library services.completion.dart; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/completion/completion_core.dart' | 9 import 'package:analysis_server/completion/completion_core.dart' |
| 10 show CompletionRequest; | 10 show CompletionRequest; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const int DART_RELEVANCE_INHERITED_FIELD = 1058; | 35 const int DART_RELEVANCE_INHERITED_FIELD = 1058; |
| 36 const int DART_RELEVANCE_INHERITED_METHOD = 1057; | 36 const int DART_RELEVANCE_INHERITED_METHOD = 1057; |
| 37 const int DART_RELEVANCE_KEYWORD = 1055; | 37 const int DART_RELEVANCE_KEYWORD = 1055; |
| 38 const int DART_RELEVANCE_LOCAL_ACCESSOR = 1057; | 38 const int DART_RELEVANCE_LOCAL_ACCESSOR = 1057; |
| 39 const int DART_RELEVANCE_LOCAL_FIELD = 1058; | 39 const int DART_RELEVANCE_LOCAL_FIELD = 1058; |
| 40 const int DART_RELEVANCE_LOCAL_FUNCTION = 1056; | 40 const int DART_RELEVANCE_LOCAL_FUNCTION = 1056; |
| 41 const int DART_RELEVANCE_LOCAL_METHOD = 1057; | 41 const int DART_RELEVANCE_LOCAL_METHOD = 1057; |
| 42 const int DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE = 1056; | 42 const int DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE = 1056; |
| 43 const int DART_RELEVANCE_LOCAL_VARIABLE = 1059; | 43 const int DART_RELEVANCE_LOCAL_VARIABLE = 1059; |
| 44 const int DART_RELEVANCE_LOW = 500; | 44 const int DART_RELEVANCE_LOW = 500; |
| 45 const int DART_RELEVANCE_NAMED_PARAMETER = 1060; |
| 45 const int DART_RELEVANCE_PARAMETER = 1059; | 46 const int DART_RELEVANCE_PARAMETER = 1059; |
| 46 const int DART_RELEVANCE_NAMED_PARAMETER = 1060; | |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * The base class for contributing code completion suggestions. | 49 * The base class for contributing code completion suggestions. |
| 50 */ | 50 */ |
| 51 abstract class DartCompletionContributor { | 51 abstract class DartCompletionContributor { |
| 52 /** | 52 /** |
| 53 * Computes the initial set of [CompletionSuggestion]s based on | 53 * Computes the initial set of [CompletionSuggestion]s based on |
| 54 * the given completion context. The compilation unit and completion node | 54 * the given completion context. The compilation unit and completion node |
| 55 * in the given completion context may not be resolved. | 55 * in the given completion context may not be resolved. |
| 56 * This method should execute quickly and not block waiting for any analysis. | 56 * This method should execute quickly and not block waiting for any analysis. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 }); | 215 }); |
| 216 } | 216 } |
| 217 | 217 |
| 218 /** | 218 /** |
| 219 * Send the current list of suggestions to the client. | 219 * Send the current list of suggestions to the client. |
| 220 */ | 220 */ |
| 221 void sendResults(DartCompletionRequest request, bool last) { | 221 void sendResults(DartCompletionRequest request, bool last) { |
| 222 if (controller == null || controller.isClosed) { | 222 if (controller == null || controller.isClosed) { |
| 223 return; | 223 return; |
| 224 } | 224 } |
| 225 controller.add(new CompletionResult(request.replacementOffset, | 225 controller.add(new CompletionResultImpl(request.replacementOffset, |
| 226 request.replacementLength, request.suggestions, last)); | 226 request.replacementLength, request.suggestions, last)); |
| 227 if (last) { | 227 if (last) { |
| 228 controller.close(); | 228 controller.close(); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 /** | 232 /** |
| 233 * Return a future that either (a) completes with the resolved compilation | 233 * Return a future that either (a) completes with the resolved compilation |
| 234 * unit when analysis is complete, or (b) completes with null if the | 234 * unit when analysis is complete, or (b) completes with null if the |
| 235 * compilation unit is never going to be resolved. | 235 * compilation unit is never going to be resolved. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 parameterNames: suggestion.parameterNames, | 373 parameterNames: suggestion.parameterNames, |
| 374 parameterTypes: suggestion.parameterTypes, | 374 parameterTypes: suggestion.parameterTypes, |
| 375 requiredParameterCount: suggestion.requiredParameterCount, | 375 requiredParameterCount: suggestion.requiredParameterCount, |
| 376 hasNamedParameters: suggestion.hasNamedParameters, | 376 hasNamedParameters: suggestion.hasNamedParameters, |
| 377 returnType: suggestion.returnType, | 377 returnType: suggestion.returnType, |
| 378 element: suggestion.element); | 378 element: suggestion.element); |
| 379 } | 379 } |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 } | 382 } |
| OLD | NEW |