(lines: string[])
| 123 | |
| 124 | class DocState { |
| 125 | public static parse(lines: string[]): DocState { |
| 126 | lines = [...lines]; |
| 127 | |
| 128 | const cursors: Position[] = []; |
| 129 | for (let i = 0; i < lines.length; ) { |
| 130 | const columnIdx = lines[i].indexOf('|'); |
| 131 | if (columnIdx >= 0) { |
| 132 | lines[i] = lines[i].replace('|', ''); |
| 133 | cursors.push(new Position(i, columnIdx)); |
| 134 | } else { |
| 135 | i++; |
| 136 | } |
| 137 | } |
| 138 | if (cursors.length === 0) { |
| 139 | throw new Error("Missing '|' in test object"); |
| 140 | } |
| 141 | |
| 142 | return new DocState(cursors, lines); |
| 143 | } |
| 144 | |
| 145 | constructor(cursors: Position[], lines: string[]) { |
| 146 | this.cursors = cursors; |
no test coverage detected