textToggleChecklistStateDocument function

TextCommandResult textToggleChecklistStateDocument({
  1. required TextDocument document,
  2. required TextLineStateSnapshot state,
  3. String checkedMarker = 'x',
})

Implementation

TextCommandResult textToggleChecklistStateDocument({
  required TextDocument document,
  required TextLineStateSnapshot state,
  String checkedMarker = 'x',
}) {
  final clampedState = _clampLineStateSnapshotToDocument(state, document);
  final span = _selectedLineSpan(clampedState);
  return _documentResultFromWindowedLineCommand(
    document: document,
    state: clampedState,
    startLine: span.startLine,
    endLine: span.endLine + 1,
    apply: (lines, localState) => textToggleChecklistState(
      lines: lines,
      state: localState,
      checkedMarker: checkedMarker,
    ),
  );
}