( prior: ExploreProjectState | null, filePath: string, fingerprint: string, )
| 181 | * exactly the case where re-serving is right. |
| 182 | */ |
| 183 | export function servedRangesForFile( |
| 184 | prior: ExploreProjectState | null, |
| 185 | filePath: string, |
| 186 | fingerprint: string, |
| 187 | ): ExploreLineRange[] { |
| 188 | if (!prior) return []; |
| 189 | const spans: ExploreLineRange[] = []; |
| 190 | for (const call of prior.calls) { |
| 191 | for (const file of call.files) { |
| 192 | if (file.path !== filePath) continue; |
| 193 | if (!file.fingerprint || file.fingerprint !== fingerprint) continue; |
| 194 | spans.push(...file.ranges); |
| 195 | } |
| 196 | } |
| 197 | return mergeRanges(spans); |
| 198 | } |
| 199 | |
| 200 | /** `L12`, `L12-40`, capped with a `+N more` tail. */ |
| 201 | export function formatSpans(spans: ReadonlyArray<ExploreLineRange>): string { |
no test coverage detected