generateNavigationResponse method

GeneratorResult<AnalysisGetNavigationResult> generateNavigationResponse(
  1. NavigationRequest request
)

Create an 'analysis.getNavigation' response for the portion of the file specified by the given request. If any of the contributors throws an exception, also create a non-fatal 'plugin.error' notification.

Implementation

GeneratorResult<AnalysisGetNavigationResult> generateNavigationResponse(
    NavigationRequest request) {
  var notifications = <Notification>[];
  var collector = NavigationCollectorImpl();
  for (var contributor in contributors) {
    try {
      contributor.computeNavigation(request, collector);
    } catch (exception, stackTrace) {
      notifications.add(PluginErrorParams(
              false, exception.toString(), stackTrace.toString())
          .toNotification());
    }
  }
  collector.createRegions();
  var result = AnalysisGetNavigationResult(
      collector.files, collector.targets, collector.regions);
  return GeneratorResult(result, notifications);
}