(state: EditorState)
| 26 | * Get all folded ranges from CodeMirror editor state |
| 27 | */ |
| 28 | export 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 |
no outgoing calls
no test coverage detected