generateAssistsResponse method

Future<GeneratorResult<EditGetAssistsResult>> generateAssistsResponse(
  1. AssistRequest request
)

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

Implementation

Future<GeneratorResult<EditGetAssistsResult>> generateAssistsResponse(
    AssistRequest request) async {
  var notifications = <Notification>[];
  var collector = AssistCollectorImpl();
  for (var contributor in contributors) {
    try {
      await contributor.computeAssists(request, collector);
    } catch (exception, stackTrace) {
      notifications.add(PluginErrorParams(
              false, exception.toString(), stackTrace.toString())
          .toNotification());
    }
  }
  var result = EditGetAssistsResult(collector.assists);
  return GeneratorResult(result, notifications);
}