Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Unified Diff: pkg/analysis_server/lib/src/services/completion/dart_completion_cache.dart

Issue 1064743002: do not suggest elements from internal sdk libs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698