(tag: SourceTagEntry, locationData: FullLocationData, sourceLines: string[])
| 206 | } |
| 207 | |
| 208 | function deriveSourceText(tag: SourceTagEntry, locationData: FullLocationData, sourceLines: string[]): string { |
| 209 | const headerLine = getDisplayLine(locationData[tag.startIndex]); |
| 210 | const singleLineLocations = range(tag.startIndex, tag.endIndex) |
| 211 | .map((idx) => locationData[idx].location) |
| 212 | .filter((loc) => loc.start.line === loc.end.line && loc.start.column !== loc.end.column); |
| 213 | |
| 214 | if (singleLineLocations.length === 0) return ''; |
| 215 | |
| 216 | const startCol = Math.min(...singleLineLocations.map((loc) => loc.start.column)); |
| 217 | const endCol = Math.max(...singleLineLocations.map((loc) => loc.end.column)); |
| 218 | return sourceLines[headerLine - 1].substring(startCol, endCol).trim(); |
| 219 | } |
no test coverage detected