| 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; | 5 library services.completion.suggestion; |
| 6 | 6 |
| 7 import 'package:analysis_services/constants.dart'; | 7 import 'package:analysis_services/constants.dart'; |
| 8 import 'package:analysis_services/json.dart'; | 8 import 'package:analysis_services/json.dart'; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * An enumeration of the relevance of a completion suggestion. | 12 * An enumeration of the relevance of a completion suggestion. |
| 13 */ | 13 */ |
| 14 class CompletionRelevance { | 14 class CompletionRelevance { |
| 15 static const CompletionRelevance LOW = const CompletionRelevance('LOW'); | 15 static const CompletionRelevance LOW = const CompletionRelevance('LOW'); |
| 16 static const CompletionRelevance DEFAULT = | 16 static const CompletionRelevance DEFAULT = |
| 17 const CompletionRelevance('DEFAULT'); | 17 const CompletionRelevance('DEFAULT'); |
| 18 static const CompletionRelevance HIGH = const CompletionRelevance('HIGH'); | 18 static const CompletionRelevance HIGH = const CompletionRelevance('HIGH'); |
| 19 | 19 |
| 20 final String name; | 20 final String name; |
| 21 | 21 |
| 22 const CompletionRelevance(this.name); | 22 const CompletionRelevance(this.name); |
| 23 | 23 |
| 24 static CompletionRelevance value(String name) { | 24 static CompletionRelevance value(String name) { |
| 25 if (LOW.name == name) return LOW; | 25 if (LOW.name == name) return LOW; |
| 26 if (DEFAULT.name == name) return DEFAULT; | 26 if (DEFAULT.name == name) return DEFAULT; |
| 27 if (HIGH.name == name) return HIGH; | 27 if (HIGH.name == name) return HIGH; |
| 28 throw new ArgumentError('Unknown CompletionRelevance: $name'); | 28 throw new ArgumentError('Unknown CompletionRelevance: $name'); |
| 29 } | 29 } |
| 30 |
| 31 toString() => 'CompletionRelevance.$name'; |
| 30 } | 32 } |
| 31 | 33 |
| 32 /** | 34 /** |
| 33 * A single completion suggestion. | 35 * A single completion suggestion. |
| 34 */ | 36 */ |
| 35 class CompletionSuggestion implements HasToJson { | 37 class CompletionSuggestion implements HasToJson { |
| 36 | 38 |
| 37 /** | 39 /** |
| 38 * The kind of element being suggested. | 40 * The kind of element being suggested. |
| 39 */ | 41 */ |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (NAMED_ARGUMENT.name == name) return NAMED_ARGUMENT; | 227 if (NAMED_ARGUMENT.name == name) return NAMED_ARGUMENT; |
| 226 if (OPTIONAL_ARGUMENT.name == name) return OPTIONAL_ARGUMENT; | 228 if (OPTIONAL_ARGUMENT.name == name) return OPTIONAL_ARGUMENT; |
| 227 if (PARAMETER.name == name) return PARAMETER; | 229 if (PARAMETER.name == name) return PARAMETER; |
| 228 if (SETTER.name == name) return SETTER; | 230 if (SETTER.name == name) return SETTER; |
| 229 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE; | 231 if (TOP_LEVEL_VARIABLE.name == name) return TOP_LEVEL_VARIABLE; |
| 230 if (TYPE_PARAMETER.name == name) return TYPE_PARAMETER; | 232 if (TYPE_PARAMETER.name == name) return TYPE_PARAMETER; |
| 231 if (VARIABLE.name == name) return VARIABLE; | 233 if (VARIABLE.name == name) return VARIABLE; |
| 232 throw new ArgumentError('Unknown CompletionSuggestionKind: $name'); | 234 throw new ArgumentError('Unknown CompletionSuggestionKind: $name'); |
| 233 } | 235 } |
| 234 } | 236 } |
| OLD | NEW |