Chromium Code Reviews| Index: pkg/analysis_server/lib/src/analysis_server.dart |
| diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart |
| index 118c4015531d38dd7ed7848d3c0653eff38d7f75..80a13abe5a059e6f5e7629463271c345093210eb 100644 |
| --- a/pkg/analysis_server/lib/src/analysis_server.dart |
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart |
| @@ -166,6 +166,13 @@ class AnalysisServer { |
| new HashMap<AnalysisService, Set<String>>(); |
| /** |
| + * A table mapping [AnalysisContext]s to the completers that should be |
| + * completed when analysis of this context is finished. |
| + */ |
| + Map<AnalysisContext, Completer> contextAnalysisDoneCompleters = |
| + new HashMap<AnalysisContext, Completer>(); |
| + |
| + /** |
| * True if any exceptions thrown by analysis should be propagated up the call |
| * stack. |
| */ |
| @@ -220,6 +227,13 @@ class AnalysisServer { |
| } |
| /** |
| + * Send the given [response] to the client. |
| + */ |
| + void sendResponse(Response response) { |
| + channel.sendResponse(response); |
| + } |
| + |
| + /** |
| * Set the priority files to the given [files]. |
| */ |
| void setPriorityFiles(Request request, List<String> files) { |
| @@ -327,6 +341,9 @@ class AnalysisServer { |
| for (int i = 0; i < count; i++) { |
| try { |
| Response response = handlers[i].handleRequest(request); |
| + if (response == Response.DELAYED_RESPONSE) { |
| + return; |
| + } |
| if (response != null) { |
| channel.sendResponse(response); |
| return; |
| @@ -617,6 +634,38 @@ class AnalysisServer { |
| } |
| /** |
| + * Returns a [Future] completing when [file] has been completely analyzed, in |
| + * particular, all its errors have been computed. |
| + */ |
| + Future onFileAnalysisComplete(String file) { |
| + // prepare AnalysisContext |
|
Paul Berry
2014/07/22 21:10:24
I can see three areas where we might want to impro
scheglov
2014/07/22 21:23:24
Unfortunately, there is no mechanism in the analys
|
| + AnalysisContext context = getAnalysisContext(file); |
| + if (context == null) { |
| + return new Future.value(); |
| + } |
| + // schedule context analysis |
| + schedulePerformAnalysisOperation(context); |
| + // associate with the context completer |
| + Completer completer = contextAnalysisDoneCompleters[context]; |
| + if (completer == null) { |
| + completer = new Completer(); |
| + contextAnalysisDoneCompleters[context] = completer; |
| + } |
| + return completer.future; |
| + } |
| + |
| + /** |
| + * This method is called when analysis of the given [AnalysisContext] is |
| + * done. |
| + */ |
| + void sendContextAnalysisDoneNotifications(AnalysisContext context) { |
| + Completer completer = contextAnalysisDoneCompleters[context]; |
| + if (completer != null) { |
| + completer.complete(); |
| + } |
| + } |
| + |
| + /** |
| * Return the [CompilationUnit] of the Dart file with the given [path]. |
| * Return `null` if the file is not a part of any context. |
| */ |