MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / getAllFolds

Function getAllFolds

src/cm/editorUtils.ts:28–44  ·  view source on GitHub ↗
(state: EditorState)

Source from the content-addressed store, hash-verified

26 * Get all folded ranges from CodeMirror editor state
27 */
28export function getAllFolds(state: EditorState): FoldSpan[] {
29 const doc = state.doc;
30 const folds: FoldSpan[] = [];
31
32 foldedRanges(state).between(0, doc.length, (from, to) => {
33 const fromPos = doc.lineAt(from);
34 const toPos = doc.lineAt(to);
35 folds.push({
36 fromLine: fromPos.number,
37 fromCol: from - fromPos.from,
38 toLine: toPos.number,
39 toCol: to - toPos.from,
40 });
41 });
42
43 return folds;
44}
45
46/**
47 * Get current selection from editor view

Callers 2

saveState.jsFile · 0.90
applyFileToEditorFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected