| 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:analysis_server/src/analysis_logger.dart'; | 10 import 'package:analysis_server/src/analysis_logger.dart'; |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 454 |
| 455 /** | 455 /** |
| 456 * Implementation for `analysis.setSubscriptions`. | 456 * Implementation for `analysis.setSubscriptions`. |
| 457 */ | 457 */ |
| 458 void setAnalysisSubscriptions(Map<AnalysisService, Set<String>> subscriptions)
{ | 458 void setAnalysisSubscriptions(Map<AnalysisService, Set<String>> subscriptions)
{ |
| 459 // send notifications for already analyzed sources | 459 // send notifications for already analyzed sources |
| 460 subscriptions.forEach((service, Set<String> newFiles) { | 460 subscriptions.forEach((service, Set<String> newFiles) { |
| 461 Set<String> oldFiles = analysisServices[service]; | 461 Set<String> oldFiles = analysisServices[service]; |
| 462 Set<String> todoFiles = oldFiles != null ? newFiles.difference(oldFiles) :
newFiles; | 462 Set<String> todoFiles = oldFiles != null ? newFiles.difference(oldFiles) :
newFiles; |
| 463 for (String file in todoFiles) { | 463 for (String file in todoFiles) { |
| 464 Source source = _getSource(file); |
| 465 AnalysisContext context = _getAnalysisContext(file); |
| 466 // errors |
| 464 if (service == AnalysisService.ERRORS) { | 467 if (service == AnalysisService.ERRORS) { |
| 465 Source source = _getSource(file); | 468 LineInfo lineInfo = context.getLineInfo(source); |
| 466 AnalysisContext analysisContext = _getAnalysisContext(file); | 469 List<AnalysisError> errors = context.getErrors(source).errors; |
| 467 LineInfo lineInfo = analysisContext.getLineInfo(source); | |
| 468 List<AnalysisError> errors = analysisContext.getErrors(source).errors; | |
| 469 sendAnalysisNotificationErrors(this, file, lineInfo, errors); | 470 sendAnalysisNotificationErrors(this, file, lineInfo, errors); |
| 470 } | 471 } |
| 471 // Dart unit notifications. | 472 // Dart unit notifications. |
| 472 if (AnalysisEngine.isDartFileName(file)) { | 473 if (AnalysisEngine.isDartFileName(file)) { |
| 473 CompilationUnit dartUnit = getResolvedCompilationUnitToResendNotificat
ion(file); | 474 CompilationUnit dartUnit = getResolvedCompilationUnitToResendNotificat
ion(file); |
| 474 if (dartUnit != null) { | 475 if (dartUnit != null) { |
| 475 switch (service) { | 476 switch (service) { |
| 476 case AnalysisService.HIGHLIGHTS: | 477 case AnalysisService.HIGHLIGHTS: |
| 477 sendAnalysisNotificationHighlights(this, file, dartUnit); | 478 sendAnalysisNotificationHighlights(this, file, dartUnit); |
| 478 break; | 479 break; |
| 479 case AnalysisService.NAVIGATION: | 480 case AnalysisService.NAVIGATION: |
| 480 // TODO(scheglov) consider support for one unit in 2+ libraries | 481 // TODO(scheglov) consider support for one unit in 2+ libraries |
| 481 sendAnalysisNotificationNavigation(this, file, dartUnit); | 482 sendAnalysisNotificationNavigation(this, file, dartUnit); |
| 482 break; | 483 break; |
| 483 case AnalysisService.OUTLINE: | 484 case AnalysisService.OUTLINE: |
| 484 sendAnalysisNotificationOutline(this, file, dartUnit); | 485 sendAnalysisNotificationOutline(this, context, source, dartUnit)
; |
| 485 break; | 486 break; |
| 486 } | 487 } |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 } | 490 } |
| 490 }); | 491 }); |
| 491 // remember new subscriptions | 492 // remember new subscriptions |
| 492 this.analysisServices = subscriptions; | 493 this.analysisServices = subscriptions; |
| 493 } | 494 } |
| 494 | 495 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 /** | 598 /** |
| 598 * An enumeration of the services provided by the server domain. | 599 * An enumeration of the services provided by the server domain. |
| 599 */ | 600 */ |
| 600 class ServerService extends Enum2<ServerService> { | 601 class ServerService extends Enum2<ServerService> { |
| 601 static const ServerService STATUS = const ServerService('STATUS', 0); | 602 static const ServerService STATUS = const ServerService('STATUS', 0); |
| 602 | 603 |
| 603 static const List<ServerService> VALUES = const [STATUS]; | 604 static const List<ServerService> VALUES = const [STATUS]; |
| 604 | 605 |
| 605 const ServerService(String name, int ordinal) : super(name, ordinal); | 606 const ServerService(String name, int ordinal) : super(name, ordinal); |
| 606 } | 607 } |
| OLD | NEW |