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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 407263002: Implementation of the 'analysis.getErrors' API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 months 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/constants.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
*/
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/constants.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698