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

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

Issue 790743003: bound the time waiting for analysis to complete (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comment 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 | no next file » | 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_manager.dart
diff --git a/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart
index c40763ca1ecb968f357952b5c27d0a25b3fd137f..023ee55937fa305bcca03aec2f174b2464e9ac6c 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart_completion_manager.dart
@@ -177,9 +177,11 @@ class DartCompletionManager extends CompletionManager {
/**
* Return a future that completes when analysis is complete.
- * Return `true` if the compilation unit is be resolved.
*/
- Future<CompilationUnit> waitForAnalysis() {
+ Future<CompilationUnit> waitForAnalysis([int waitCount = 10000]) {
+ //TODO (danrubel) replace this when new API is ready.
+ // I expect the new API to be either a stream of resolution events
+ // or a future that completes when the resolved library element is available
LibraryElement library = context.getLibraryElement(source);
if (library != null) {
CompilationUnit unit =
@@ -188,8 +190,13 @@ class DartCompletionManager extends CompletionManager {
return new Future.value(unit);
}
}
- //TODO (danrubel) Determine if analysis is complete but unit not resolved
- return new Future(waitForAnalysis);
+ //TODO (danrubel) Remove this HACK
+ if (waitCount > 0) {
+ return new Future(() {
+ return waitForAnalysis(waitCount - 1);
+ });
+ }
+ return new Future.value(null);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698