| 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.suggestion.builder; | 5 library services.completion.suggestion.builder; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/protocol_server.dart' as protocol; | 10 import 'package:analysis_server/src/protocol_server.dart' as protocol; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 bool isDeprecated = element.isDeprecated; | 40 bool isDeprecated = element.isDeprecated; |
| 41 CompletionSuggestion suggestion = new CompletionSuggestion( | 41 CompletionSuggestion suggestion = new CompletionSuggestion( |
| 42 kind, | 42 kind, |
| 43 isDeprecated ? DART_RELEVANCE_LOW : relevance, | 43 isDeprecated ? DART_RELEVANCE_LOW : relevance, |
| 44 completion, | 44 completion, |
| 45 completion.length, | 45 completion.length, |
| 46 0, | 46 0, |
| 47 isDeprecated, | 47 isDeprecated, |
| 48 false); | 48 false); |
| 49 suggestion.element = protocol.newElement_fromEngine(element); | 49 suggestion.element = protocol.convertElement(element); |
| 50 Element enclosingElement = element.enclosingElement; | 50 Element enclosingElement = element.enclosingElement; |
| 51 if (enclosingElement is ClassElement) { | 51 if (enclosingElement is ClassElement) { |
| 52 suggestion.declaringType = enclosingElement.displayName; | 52 suggestion.declaringType = enclosingElement.displayName; |
| 53 } | 53 } |
| 54 suggestion.returnType = getReturnTypeString(element); | 54 suggestion.returnType = getReturnTypeString(element); |
| 55 if (element is ExecutableElement && element is! PropertyAccessorElement) { | 55 if (element is ExecutableElement && element is! PropertyAccessorElement) { |
| 56 suggestion.parameterNames = element.parameters | 56 suggestion.parameterNames = element.parameters |
| 57 .map((ParameterElement parameter) => parameter.name) | 57 .map((ParameterElement parameter) => parameter.name) |
| 58 .toList(); | 58 .toList(); |
| 59 suggestion.parameterTypes = element.parameters | 59 suggestion.parameterTypes = element.parameters |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 * or `false` if [computeFull] should be called. | 668 * or `false` if [computeFull] should be called. |
| 669 */ | 669 */ |
| 670 bool computeFast(AstNode node); | 670 bool computeFast(AstNode node); |
| 671 | 671 |
| 672 /** | 672 /** |
| 673 * Return a future that computes the suggestions given a fully resolved AST. | 673 * Return a future that computes the suggestions given a fully resolved AST. |
| 674 * The future returns `true` if suggestions were added, else `false`. | 674 * The future returns `true` if suggestions were added, else `false`. |
| 675 */ | 675 */ |
| 676 Future<bool> computeFull(AstNode node); | 676 Future<bool> computeFull(AstNode node); |
| 677 } | 677 } |
| OLD | NEW |