* Get label for a SQL block - show first meaningful line.
(content: string)
| 99 | * Get label for a SQL block - show first meaningful line. |
| 100 | */ |
| 101 | function getSqlBlockLabel(content: string): string { |
| 102 | const lines = content.split('\n') |
| 103 | |
| 104 | for (const line of lines) { |
| 105 | const trimmed = line.trim() |
| 106 | // Skip SQL comments |
| 107 | if (trimmed.startsWith('--')) { |
| 108 | // Use comment as label if it's descriptive |
| 109 | const comment = trimmed.slice(2).trim() |
| 110 | if (comment) { |
| 111 | return truncate(`-- ${comment}`, MAX_LABEL_LENGTH) |
| 112 | } |
| 113 | continue |
| 114 | } |
| 115 | if (trimmed) { |
| 116 | return truncate(trimmed, MAX_LABEL_LENGTH) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | return 'sql (empty)' |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Get label for a markdown block - show first line. |
no test coverage detected