toOffsetRange method

TextDiagnosticRange toOffsetRange(
  1. TextDocument document
)

Implementation

TextDiagnosticRange toOffsetRange(TextDocument document) {
  final normalizedRange = clamp(document).normalized();
  return TextDiagnosticRange(
    startOffset: document.offsetForPosition(
      TextPosition(
        line: normalizedRange.startLine,
        column: normalizedRange.startColumn,
      ),
    ),
    endOffset: document.offsetForPosition(
      TextPosition(
        line: normalizedRange.endLine,
        column: normalizedRange.endColumn,
      ),
    ),
    severity: severity,
    code: code,
    message: message,
    source: source,
  );
}