generateFixesResponse method

Future<GeneratorResult<EditGetFixesResult>> generateFixesResponse(
  1. FixesRequest request
)

Create an 'edit.getFixes' 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<EditGetFixesResult>> generateFixesResponse(
  FixesRequest request,
) async {
  var notifications = <Notification>[];
  var collector = FixCollectorImpl();
  for (var contributor in contributors) {
    try {
      await contributor.computeFixes(request, collector);
    } catch (exception, stackTrace) {
      notifications.add(
        PluginErrorParams(
          false,
          exception.toString(),
          stackTrace.toString(),
        ).toNotification(),
      );
    }
  }
  var result = EditGetFixesResult(collector.fixes);
  return GeneratorResult(result, notifications);
}