| 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.cache; | 5 library services.completion.dart.cache; |
| 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' | 10 import 'package:analysis_server/src/protocol_server.dart' |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 */ | 179 */ |
| 180 void _addConstructorSuggestions(ClassElement classElem, int relevance) { | 180 void _addConstructorSuggestions(ClassElement classElem, int relevance) { |
| 181 String className = classElem.name; | 181 String className = classElem.name; |
| 182 for (ConstructorElement constructor in classElem.constructors) { | 182 for (ConstructorElement constructor in classElem.constructors) { |
| 183 if (!constructor.isPrivate) { | 183 if (!constructor.isPrivate) { |
| 184 CompletionSuggestion suggestion = | 184 CompletionSuggestion suggestion = |
| 185 createSuggestion(constructor, relevance: relevance); | 185 createSuggestion(constructor, relevance: relevance); |
| 186 String name = suggestion.completion; | 186 String name = suggestion.completion; |
| 187 name = name.length > 0 ? '$className.$name' : className; | 187 name = name.length > 0 ? '$className.$name' : className; |
| 188 suggestion.completion = name; | 188 suggestion.completion = name; |
| 189 suggestion.element.name = name; | |
| 190 suggestion.selectionOffset = suggestion.completion.length; | 189 suggestion.selectionOffset = suggestion.completion.length; |
| 191 importedConstructorSuggestions.add(suggestion); | 190 importedConstructorSuggestions.add(suggestion); |
| 192 } | 191 } |
| 193 } | 192 } |
| 194 } | 193 } |
| 195 | 194 |
| 196 /** | 195 /** |
| 197 * Add suggestions for implicitly imported elements in dart:core. | 196 * Add suggestions for implicitly imported elements in dart:core. |
| 198 */ | 197 */ |
| 199 void _addDartCoreSuggestions() { | 198 void _addDartCoreSuggestions() { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 @override | 376 @override |
| 378 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { | 377 void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) { |
| 379 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); | 378 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); |
| 380 } | 379 } |
| 381 | 380 |
| 382 @override | 381 @override |
| 383 void visitTopLevelVariableElement(TopLevelVariableElement element) { | 382 void visitTopLevelVariableElement(TopLevelVariableElement element) { |
| 384 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); | 383 cache._addSuggestion(element, DART_RELEVANCE_DEFAULT); |
| 385 } | 384 } |
| 386 } | 385 } |
| OLD | NEW |