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

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

Issue 784853003: include lower relevance suggestions only if they are already cached (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2053b343920559273f4b2741ce0222707347232d..87ae27c618fa7c0b401792e8609017edf7602af5 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
@@ -77,7 +77,10 @@ class DartCompletionCache extends CompletionCache {
/**
* Compute suggestions based upon the imports in the given compilation unit.
- * Return a future that completes when the information has been cached.
+ * On return, the cache will be populated except for lower priority
+ * suggestions added as a result of a global search. Callers may wait
+ * on the returned future if they want to ensure those lower priority
+ * suggestions are part of the cached suggestions.
*/
Future<bool> computeImportInfo(CompilationUnit unit,
SearchEngine searchEngine) {
@@ -130,8 +133,16 @@ class DartCompletionCache extends CompletionCache {
addSuggestion(elem, CompletionRelevance.DEFAULT);
});
+ /*
+ * Don't wait for search of lower relevance results to complete.
+ * Set key indicating results are ready, and lower relevance results
+ * will be added to the cache when the search completes.
+ */
+ _importKey = _computeImportKey(unit);
+
// Add non-imported elements as low relevance
- var future = searchEngine.searchTopLevelDeclarations('');
+ Future<List<SearchMatch>> future =
+ searchEngine.searchTopLevelDeclarations('');
return future.then((List<SearchMatch> matches) {
matches.forEach((SearchMatch match) {
if (match.kind == MatchKind.DECLARATION) {
@@ -143,7 +154,6 @@ class DartCompletionCache extends CompletionCache {
}
}
});
- _importKey = _computeImportKey(unit);
return true;
});
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698