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

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

Issue 307963006: Implementation of 'notification.highlight' API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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
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 d4bcb3d16ca11ebb9b34de3de3b058fd92b7b9f1..dc533166a399fb98cd1d27259575c3144918b09a 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -20,6 +20,7 @@ import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/sdk_io.dart';
import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analysis_server/src/computers.dart';
/**
@@ -261,13 +262,25 @@ class AnalysisServer {
for (int i = 0; i < notices.length; i++) {
ChangeNotice notice = notices[i];
Source source = notice.source;
- // send "analysis.errors" notification
- // TODO(scheglov) use subscriptions to determine if we should do this
+ CompilationUnit dartUnit = notice.compilationUnit;
+ // TODO(scheglov) use subscriptions to determine notifications to send
if (!source.isInSystemLibrary) {
- Notification notification = new Notification(AnalysisDomainHandler.ERRORS_NOTIFICATION);
- notification.setParameter(FILE_PARAM, source.fullName);
- notification.setParameter(ERRORS_PARAM, notice.errors.map(errorToJson).toList());
- sendNotification(notification);
+ // errors
+ {
+ Notification notification = new Notification(AnalysisDomainHandler.ERRORS_NOTIFICATION);
+ notification.setParameter(FILE_PARAM, source.fullName);
+ notification.setParameter(ERRORS_PARAM, notice.errors.map(errorToJson).toList());
+ sendNotification(notification);
+ }
+ // highlights
+ if (dartUnit != null) {
+ Notification notification = new Notification(AnalysisDomainHandler.HIGHLIGHTS_NOTIFICATION);
+ notification.setParameter(FILE_PARAM, source.fullName);
+ notification.setParameter(
+ AnalysisDomainHandler.REGIONS_PARAM,
+ new DartUnitHighlightsComputer(dartUnit).compute());
+ sendNotification(notification);
+ }
}
}
}
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/computers.dart » ('j') | pkg/analysis_server/lib/src/computers.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698