(hashPart: string)
| 111 | } |
| 112 | |
| 113 | function parseLineFragment(hashPart: string): { startLine: number; endLine: number } | null { |
| 114 | if (!hashPart) { |
| 115 | return { startLine: 0, endLine: 0 }; |
| 116 | } |
| 117 | |
| 118 | const rangeMatch = hashPart.match(/^L?(\d+)-L?(\d+)$/i); |
| 119 | if (rangeMatch?.[1] && rangeMatch[2]) { |
| 120 | const startLine = Math.max(1, Number.parseInt(rangeMatch[1], 10)); |
| 121 | const endLine = Math.max(startLine, Number.parseInt(rangeMatch[2], 10)); |
| 122 | return { startLine, endLine }; |
| 123 | } |
| 124 | |
| 125 | const singleMatch = hashPart.match(/^L?(\d+)$/i); |
| 126 | if (singleMatch?.[1]) { |
| 127 | const startLine = Math.max(1, Number.parseInt(singleMatch[1], 10)); |
| 128 | return { startLine, endLine: 0 }; |
| 129 | } |
| 130 | |
| 131 | return null; |
| 132 | } |
| 133 | |
| 134 | function indentMultiline(text: string, indent: string): string { |
| 135 | if (!indent) return text; |
no outgoing calls
no test coverage detected