( currentFileContent: string, windowStart: number, windowEnd: number, editableRegionStartLine: number, editableRegionEndLine: number, cursorPosition: Position, )
| 37 | } |
| 38 | |
| 39 | export function currentFileContentBlock( |
| 40 | currentFileContent: string, |
| 41 | windowStart: number, |
| 42 | windowEnd: number, |
| 43 | editableRegionStartLine: number, |
| 44 | editableRegionEndLine: number, |
| 45 | cursorPosition: Position, |
| 46 | ) { |
| 47 | const currentFileContentLines = currentFileContent.split("\n"); |
| 48 | |
| 49 | const insertedCursorLines = insertCursorToken( |
| 50 | currentFileContentLines, |
| 51 | cursorPosition, |
| 52 | INSTINCT_USER_CURSOR_IS_HERE_TOKEN, |
| 53 | ); |
| 54 | |
| 55 | const instrumentedLines = [ |
| 56 | ...insertedCursorLines.slice(windowStart, editableRegionStartLine), |
| 57 | INSTINCT_EDITABLE_REGION_START_TOKEN, |
| 58 | ...insertedCursorLines.slice( |
| 59 | editableRegionStartLine, |
| 60 | editableRegionEndLine + 1, |
| 61 | ), |
| 62 | INSTINCT_EDITABLE_REGION_END_TOKEN, |
| 63 | ...insertedCursorLines.slice(editableRegionEndLine + 1, windowEnd + 1), |
| 64 | ]; |
| 65 | |
| 66 | return instrumentedLines.join("\n"); |
| 67 | } |
| 68 | |
| 69 | export function editHistoryBlock( |
| 70 | editDiffHistories: string[], // array of unified diffs with Index headers |
no test coverage detected