| Index: pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
|
| diff --git a/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart b/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
|
| index d8afca40706b15e297f24c3cfa1494ac7718e5a1..eebe6a5d3d4ac073fc3e825900fe279c036bdb26 100644
|
| --- a/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
|
| +++ b/pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart
|
| @@ -177,12 +177,13 @@ class DartCompletionCache extends CompletionCache {
|
| /**
|
| * Add constructor suggestions for the given class.
|
| */
|
| - void _addConstructorSuggestions(ClassElement classElem, int relevance) {
|
| + void _addConstructorSuggestions(
|
| + ClassElement classElem, int relevance, Source importForSource) {
|
| String className = classElem.name;
|
| for (ConstructorElement constructor in classElem.constructors) {
|
| if (!constructor.isPrivate) {
|
| - CompletionSuggestion suggestion =
|
| - createSuggestion(constructor, relevance: relevance);
|
| + CompletionSuggestion suggestion = createSuggestion(constructor,
|
| + relevance: relevance, importForSource: importForSource);
|
| String name = suggestion.completion;
|
| name = name.length > 0 ? '$className.$name' : className;
|
| suggestion.completion = name;
|
| @@ -299,7 +300,7 @@ class DartCompletionCache extends CompletionCache {
|
| element.isPublic &&
|
| !excludedLibs.contains(element.library) &&
|
| !_importedCompletions.contains(element.displayName)) {
|
| - _addSuggestion(element, DART_RELEVANCE_LOW);
|
| + _addSuggestion(element, DART_RELEVANCE_LOW, importForSource: source);
|
| }
|
| }
|
| });
|
| @@ -308,7 +309,8 @@ class DartCompletionCache extends CompletionCache {
|
| /**
|
| * Add a suggestion for the given element.
|
| */
|
| - void _addSuggestion(Element element, int relevance) {
|
| + void _addSuggestion(Element element, int relevance,
|
| + {Source importForSource}) {
|
| if (element is ExecutableElement) {
|
| // Do not suggest operators or local functions
|
| if (element.isOperator) {
|
| @@ -321,8 +323,8 @@ class DartCompletionCache extends CompletionCache {
|
| }
|
| }
|
|
|
| - CompletionSuggestion suggestion =
|
| - createSuggestion(element, relevance: relevance);
|
| + CompletionSuggestion suggestion = createSuggestion(element,
|
| + relevance: relevance, importForSource: importForSource);
|
|
|
| if (element is ExecutableElement) {
|
| DartType returnType = element.returnType;
|
| @@ -335,7 +337,7 @@ class DartCompletionCache extends CompletionCache {
|
| importedTypeSuggestions.add(suggestion);
|
| } else if (element is ClassElement) {
|
| importedTypeSuggestions.add(suggestion);
|
| - _addConstructorSuggestions(element, relevance);
|
| + _addConstructorSuggestions(element, relevance, importForSource);
|
| } else {
|
| otherImportedSuggestions.add(suggestion);
|
| }
|
|
|