| 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 /** | 463 /** |
| 464 * Implementation for `analysis.setSubscriptions`. | 464 * Implementation for `analysis.setSubscriptions`. |
| 465 */ | 465 */ |
| 466 void setAnalysisSubscriptions(Map<AnalysisService, Set<String>> subscriptions)
{ | 466 void setAnalysisSubscriptions(Map<AnalysisService, Set<String>> subscriptions)
{ |
| 467 // send notifications for already analyzed sources | 467 // send notifications for already analyzed sources |
| 468 subscriptions.forEach((service, Set<String> newFiles) { | 468 subscriptions.forEach((service, Set<String> newFiles) { |
| 469 Set<String> oldFiles = analysisServices[service]; | 469 Set<String> oldFiles = analysisServices[service]; |
| 470 Set<String> todoFiles = oldFiles != null ? newFiles.difference(oldFiles) :
newFiles; | 470 Set<String> todoFiles = oldFiles != null ? newFiles.difference(oldFiles) :
newFiles; |
| 471 for (String file in todoFiles) { | 471 for (String file in todoFiles) { |
| 472 Source source = getSource(file); | 472 Source source = getSource(file); |
| 473 // prepare context |
| 473 AnalysisContext context = getAnalysisContext(file); | 474 AnalysisContext context = getAnalysisContext(file); |
| 475 if (context == null) { |
| 476 continue; |
| 477 } |
| 474 // errors | 478 // errors |
| 475 if (service == AnalysisService.ERRORS) { | 479 if (service == AnalysisService.ERRORS) { |
| 476 LineInfo lineInfo = context.getLineInfo(source); | 480 LineInfo lineInfo = context.getLineInfo(source); |
| 477 List<AnalysisError> errors = context.getErrors(source).errors; | 481 if (lineInfo != null) { |
| 478 sendAnalysisNotificationErrors(this, file, lineInfo, errors); | 482 List<AnalysisError> errors = context.getErrors(source).errors; |
| 483 sendAnalysisNotificationErrors(this, file, lineInfo, errors); |
| 484 } |
| 479 } | 485 } |
| 480 // Dart unit notifications. | 486 // Dart unit notifications. |
| 481 if (AnalysisEngine.isDartFileName(file)) { | 487 if (AnalysisEngine.isDartFileName(file)) { |
| 482 CompilationUnit dartUnit = getResolvedCompilationUnitToResendNotificat
ion(file); | 488 CompilationUnit dartUnit = getResolvedCompilationUnitToResendNotificat
ion(file); |
| 483 if (dartUnit != null) { | 489 if (dartUnit != null) { |
| 484 switch (service) { | 490 switch (service) { |
| 485 case AnalysisService.HIGHLIGHTS: | 491 case AnalysisService.HIGHLIGHTS: |
| 486 sendAnalysisNotificationHighlights(this, file, dartUnit); | 492 sendAnalysisNotificationHighlights(this, file, dartUnit); |
| 487 break; | 493 break; |
| 488 case AnalysisService.NAVIGATION: | 494 case AnalysisService.NAVIGATION: |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 /** | 664 /** |
| 659 * An enumeration of the services provided by the server domain. | 665 * An enumeration of the services provided by the server domain. |
| 660 */ | 666 */ |
| 661 class ServerService extends Enum2<ServerService> { | 667 class ServerService extends Enum2<ServerService> { |
| 662 static const ServerService STATUS = const ServerService('STATUS', 0); | 668 static const ServerService STATUS = const ServerService('STATUS', 0); |
| 663 | 669 |
| 664 static const List<ServerService> VALUES = const [STATUS]; | 670 static const List<ServerService> VALUES = const [STATUS]; |
| 665 | 671 |
| 666 const ServerService(String name, int ordinal) : super(name, ordinal); | 672 const ServerService(String name, int ordinal) : super(name, ordinal); |
| 667 } | 673 } |
| OLD | NEW |