| 127 | } |
| 128 | |
| 129 | function extractHeader(content: string): string { |
| 130 | const lines = content.split("\n"); |
| 131 | const headerLines: string[] = []; |
| 132 | for (const line of lines.slice(0, 5)) { |
| 133 | const trimmed = line.trim(); |
| 134 | if (trimmed.startsWith("//") || trimmed.startsWith("#") || trimmed.startsWith("--")) { |
| 135 | headerLines.push(trimmed.replace(/^\/\/\s*|^#\s*|^--\s*/, "")); |
| 136 | } else if (trimmed.length > 0) { |
| 137 | break; |
| 138 | } |
| 139 | } |
| 140 | return headerLines.join(" ").substring(0, 200); |
| 141 | } |
| 142 | |
| 143 | function formatLineRange(line: number, endLine: number): string { |
| 144 | return endLine > line ? `L${line}-L${endLine}` : `L${line}`; |