generateHighlightsNotification method

GeneratorResult<ResponseResult?> generateHighlightsNotification(
  1. HighlightsRequest request
)

Create an 'analysis.highlights' notification. If any of the contributors throws an exception, also create a non-fatal 'plugin.error' notification.

Implementation

GeneratorResult generateHighlightsNotification(HighlightsRequest request) {
  var notifications = <Notification>[];
  var collector = HighlightsCollectorImpl();
  for (var contributor in contributors) {
    try {
      contributor.computeHighlights(request, collector);
    } catch (exception, stackTrace) {
      notifications.add(PluginErrorParams(
              false, exception.toString(), stackTrace.toString())
          .toNotification());
    }
  }
  notifications.add(AnalysisHighlightsParams(request.path, collector.regions)
      .toNotification());
  return GeneratorResult(null, notifications);
}