(content: string, startLine: number, endLine: number)
| 221 | } |
| 222 | |
| 223 | export function sliceFileContent(content: string, startLine: number, endLine: number): string { |
| 224 | if (startLine <= 1 && endLine <= 0) { |
| 225 | return content; |
| 226 | } |
| 227 | |
| 228 | const lines = content.split("\n"); |
| 229 | const clampedStart = Math.min(Math.max(startLine, 1), lines.length); |
| 230 | const clampedEnd = endLine > 0 ? Math.min(Math.max(endLine, clampedStart), lines.length) : lines.length; |
| 231 | return lines.slice(clampedStart - 1, clampedEnd).join("\n"); |
| 232 | } |
| 233 | |
| 234 | export async function expandCodeEmbedsInMarkdown( |
| 235 | plugin: CodeSpacePlugin, |
no outgoing calls
no test coverage detected