Chromium Code Reviews| 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..2179571a95283e413b618ec6540e2c03cd1d9531 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,12 @@ 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(() { |
| + waitForAnalysis(waitCount - 1); |
|
Paul Berry
2014/12/09 19:24:08
I believe this needs to be "return waitForAnalysis
danrubel
2014/12/09 23:51:52
Good catch. Done.
|
| + }); |
| + } |
| } |
| } |