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

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

Issue 352823005: send status notification when analysis starts and ends (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and address comments Created 6 years, 6 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/test/analysis_server_test.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 3ddb9f7e7c7234fee6320706e610ce16b437592d..299bd8a363c1cc6145c6695d51cd36e5c1b2141b 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -108,6 +108,12 @@ class AnalysisServer {
bool running;
/**
+ * A flag indicating the value of the 'analyzing' parameter sent in the last
+ * status message to the client.
+ */
+ bool statusAnalyzing = false;
+
+ /**
* A list of the request handlers used to handle the requests sent to this
* server.
*/
@@ -347,6 +353,7 @@ class AnalysisServer {
}
// prepare next operation
ServerOperation operation = operationQueue.take();
+ sendStatusNotification(operation);
// perform the operation
try {
operation.perform(this);
@@ -367,19 +374,19 @@ class AnalysisServer {
}
/**
- * Send status notification to the client. The `contextId` indicates
- * the current context being analyzed or `null` if analysis is complete.
+ * Send status notification to the client. The `operation` is the operation
+ * being performed or `null` if analysis is complete.
*/
- void sendStatusNotification(String contextId) {
+ void sendStatusNotification(ServerOperation operation) {
+ // Only send status when it changes
+ bool isAnalyzing = operation != null;
+ if (statusAnalyzing == isAnalyzing) {
+ return;
+ }
+ statusAnalyzing = isAnalyzing;
Notification notification = new Notification(SERVER_STATUS);
Map<String, Object> analysis = new Map();
- if (contextId != null) {
- analysis['analyzing'] = true;
- // TODO(danrubel): replace contextId with real analysisTarget
- analysis['analysisTarget'] = contextId;
- } else {
- analysis['analyzing'] = false;
- }
+ analysis['analyzing'] = isAnalyzing;
notification.params['analysis'] = analysis;
channel.sendNotification(notification);
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698