| Index: pkg/analysis_services/lib/src/completion/top_level_computer.dart
|
| diff --git a/pkg/analysis_services/lib/src/completion/top_level_computer.dart b/pkg/analysis_services/lib/src/completion/top_level_computer.dart
|
| index d725b8e96cab4140e0ab235a0f00110ab4e26fe5..23bda1d69bc47eb9bd3b34d0f047ad4a7a5aa7d7 100644
|
| --- a/pkg/analysis_services/lib/src/completion/top_level_computer.dart
|
| +++ b/pkg/analysis_services/lib/src/completion/top_level_computer.dart
|
| @@ -31,27 +31,31 @@ class TopLevelComputer extends CompletionComputer {
|
|
|
| // Compute the set of visible libraries to determine relevance
|
| var visibleLibraries = new Set<LibraryElement>();
|
| - visibleLibraries.add(unit.element.library);
|
| - visibleLibraries.addAll(unit.element.library.importedLibraries);
|
| + var unitLibrary = unit.element.library;
|
| + visibleLibraries.add(unitLibrary);
|
| + visibleLibraries.addAll(unitLibrary.importedLibraries);
|
|
|
| // Compute the set of possible classes and top level variables
|
| var suggestions = new List<CompletionSuggestion>();
|
| matches.forEach((SearchMatch match) {
|
| if (match.kind == MatchKind.DECLARATION) {
|
| Element element = match.element;
|
| - String completion = element.displayName;
|
| - suggestions.add(
|
| - new CompletionSuggestion(
|
| - CompletionSuggestionKind.fromElementKind(element.kind),
|
| - visibleLibraries.contains(element.library) ?
|
| - CompletionRelevance.DEFAULT :
|
| - CompletionRelevance.LOW,
|
| - completion,
|
| - completion.length,
|
| - 0,
|
| - element.isDeprecated,
|
| - false // isPotential
|
| - ));
|
| + if (element.isPublic || element.library == unitLibrary) {
|
| + String completion = element.displayName;
|
| + var relevance = visibleLibraries.contains(element.library) ?
|
| + CompletionRelevance.DEFAULT :
|
| + CompletionRelevance.LOW;
|
| + suggestions.add(
|
| + new CompletionSuggestion(
|
| + CompletionSuggestionKind.fromElementKind(element.kind),
|
| + relevance,
|
| + completion,
|
| + completion.length,
|
| + 0,
|
| + element.isDeprecated,
|
| + false // isPotential
|
| + ));
|
| + }
|
| }
|
| });
|
| return suggestions;
|
|
|