setDiagnostics method

bool setDiagnostics(
  1. Iterable<TextDiagnosticRange> diagnostics
)

Implementation

bool setDiagnostics(Iterable<TextDiagnosticRange> diagnostics) {
  _refreshDocumentSnapshot();
  final normalizedDiagnostics = normalizeTextDiagnostics(
    diagnostics,
    maxLength: _document.length,
  );
  _diagnostics = normalizedDiagnostics;
  final changedRanges = setDecorationLayer(
    textDiagnosticsDecorationLayerKey,
    textDiagnosticDecorations(normalizedDiagnostics),
    priority: textDiagnosticsDecorationLayerPriority,
  );
  final changedLines = setLineDecorationLayer(
    textDiagnosticsLineDecorationLayerKey,
    textDiagnosticLineDecorations(
      text: value,
      diagnostics: normalizedDiagnostics,
    ),
    priority: textDiagnosticsLineDecorationLayerPriority,
  );
  return changedRanges || changedLines;
}