Chromium Code Reviews| 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 e7f3600e1975166f992e926fb11f6ebd3cc95cbe..679391d6bc91aeeaf8071d5d0a71b322fda5375f 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 |
| @@ -18,6 +18,7 @@ import 'package:analyzer/src/generated/element.dart'; |
| import 'package:analyzer/src/generated/engine.dart'; |
| import 'package:analyzer/src/generated/resolver.dart'; |
| import 'package:analyzer/src/generated/source.dart'; |
| +import 'package:analyzer/src/generated/sdk.dart'; |
| /** |
| * The `DartCompletionCache` contains cached information from a prior code |
| @@ -277,6 +278,20 @@ class DartCompletionCache extends CompletionCache { |
| */ |
| void _addNonImportedElementSuggestions( |
| List<SearchMatch> matches, Set<LibraryElement> excludedLibs) { |
| + |
| + // Exclude internal Dart SDK libraries |
| + for (var lib in context.sourceFactory.dartSdk.sdkLibraries) { |
|
Paul Berry
2015/04/07 01:40:27
Please replace "var" with "SdkLibrary". I had to
|
| + if (lib.isInternal) { |
| + Source libUri = context.sourceFactory.forUri(lib.shortName); |
| + if (libUri != null) { |
| + LibraryElement libElem = context.getLibraryElement(libUri); |
| + if (libElem != null) { |
| + excludedLibs.add(libElem); |
| + } |
| + } |
| + } |
| + } |
| + |
| AnalysisContext sdkContext = context.sourceFactory.dartSdk.context; |
| matches.forEach((SearchMatch match) { |
| if (match.kind == MatchKind.DECLARATION) { |