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

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

Issue 1525753003: extract LocalLibraryContributor from imported reference contributor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years 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 4cb0ab7415816be89a54ec62ac181638097f1948..87001d3876091493aa05f8490a6a2e0f4c9464f2 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
@@ -240,14 +240,16 @@ class DartCompletionCache extends CompletionCache {
}
}
} else if (directive is PartDirective) {
- CompilationUnitElement partElem = directive.element;
- if (partElem != null && partElem.source != source) {
- partElem.accept(new _NonLocalElementCacheVisitor(this));
- }
+ // Suggested by LocalLibraryContributor
+ // CompilationUnitElement partElem = directive.element;
+ // if (partElem != null && partElem.source != source) {
+ // partElem.accept(new _NonLocalElementCacheVisitor(this));
+ // }
}
});
if (libSource != source) {
- libUnit.element.accept(new _NonLocalElementCacheVisitor(this));
+ // Suggested by LocalLibraryContributor
+ // libUnit.element.accept(new _NonLocalElementCacheVisitor(this));
}
}
}
@@ -353,44 +355,3 @@ class DartCompletionCache extends CompletionCache {
return new Future.value(null);
}
}
-
-/**
- * A visitor for building suggestions based upon the elements defined by
- * a source file contained in the same library but not the same as
- * the source in which the completions are being requested.
- */
-class _NonLocalElementCacheVisitor extends GeneralizingElementVisitor {
- final DartCompletionCache cache;
-
- _NonLocalElementCacheVisitor(this.cache);
-
- @override
- void visitClassElement(ClassElement element) {
- cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
- }
-
- @override
- void visitCompilationUnitElement(CompilationUnitElement element) {
- element.visitChildren(this);
- }
-
- @override
- void visitElement(Element element) {
- // ignored
- }
-
- @override
- void visitFunctionElement(FunctionElement element) {
- cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
- }
-
- @override
- void visitFunctionTypeAliasElement(FunctionTypeAliasElement element) {
- cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
- }
-
- @override
- void visitTopLevelVariableElement(TopLevelVariableElement element) {
- cache._addSuggestion(element, DART_RELEVANCE_DEFAULT);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698