| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analysis.server; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 sendStatusNotification(null); | 424 sendStatusNotification(null); |
| 425 } | 425 } |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 /** | 429 /** |
| 430 * Send status notification to the client. The `operation` is the operation | 430 * Send status notification to the client. The `operation` is the operation |
| 431 * being performed or `null` if analysis is complete. | 431 * being performed or `null` if analysis is complete. |
| 432 */ | 432 */ |
| 433 void sendStatusNotification(ServerOperation operation) { | 433 void sendStatusNotification(ServerOperation operation) { |
| 434 // Only send status when subscribed. |
| 435 if (!serverServices.contains(ServerService.STATUS)) { |
| 436 return; |
| 437 } |
| 434 // Only send status when it changes | 438 // Only send status when it changes |
| 435 bool isAnalyzing = operation != null; | 439 bool isAnalyzing = operation != null; |
| 436 if (statusAnalyzing == isAnalyzing) { | 440 if (statusAnalyzing == isAnalyzing) { |
| 437 return; | 441 return; |
| 438 } | 442 } |
| 439 statusAnalyzing = isAnalyzing; | 443 statusAnalyzing = isAnalyzing; |
| 440 Notification notification = new Notification(SERVER_STATUS); | 444 Notification notification = new Notification(SERVER_STATUS); |
| 441 Map<String, Object> analysis = new HashMap(); | 445 Map<String, Object> analysis = new HashMap(); |
| 442 analysis['analyzing'] = isAnalyzing; | 446 analysis['analyzing'] = isAnalyzing; |
| 443 notification.params['analysis'] = analysis; | 447 notification.params['analysis'] = analysis; |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 /** | 826 /** |
| 823 * An enumeration of the services provided by the server domain. | 827 * An enumeration of the services provided by the server domain. |
| 824 */ | 828 */ |
| 825 class ServerService extends Enum2<ServerService> { | 829 class ServerService extends Enum2<ServerService> { |
| 826 static const ServerService STATUS = const ServerService('STATUS', 0); | 830 static const ServerService STATUS = const ServerService('STATUS', 0); |
| 827 | 831 |
| 828 static const List<ServerService> VALUES = const [STATUS]; | 832 static const List<ServerService> VALUES = const [STATUS]; |
| 829 | 833 |
| 830 const ServerService(String name, int ordinal) : super(name, ordinal); | 834 const ServerService(String name, int ordinal) : super(name, ordinal); |
| 831 } | 835 } |
| OLD | NEW |