| 192 | const GREP_LINE_RE = /^([^:]+):(\d+):(.*)$/; |
| 193 | |
| 194 | function parseSearchResults(text: string): SearchResult[] { |
| 195 | const results: SearchResult[] = []; |
| 196 | for (const line of text.split("\n")) { |
| 197 | const match = GREP_LINE_RE.exec(line.trim()); |
| 198 | if (!match) continue; |
| 199 | const [, path, lineStr, content] = match; |
| 200 | results.push({ path, line: parseInt(lineStr, 10), content: content.trim() }); |
| 201 | } |
| 202 | return results; |
| 203 | } |
| 204 | |
| 205 | // --------------------------------------------------------------------------- |
| 206 | // FileAPI |