MCPcopy Create free account
hub / github.com/continuedev/continue / currentFileContentBlock

Function currentFileContentBlock

core/nextEdit/templating/instinct.ts:39–67  ·  view source on GitHub ↗
(
  currentFileContent: string,
  windowStart: number,
  windowEnd: number,
  editableRegionStartLine: number,
  editableRegionEndLine: number,
  cursorPosition: Position,
)

Source from the content-addressed store, hash-verified

37}
38
39export 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
69export function editHistoryBlock(
70 editDiffHistories: string[], // array of unified diffs with Index headers

Callers 5

instinct.vitest.tsFile · 0.90
generatePromptsMethod · 0.50
buildPromptMetadataMethod · 0.50
generatePromptsMethod · 0.50
buildPromptMetadataMethod · 0.50

Calls 1

insertCursorTokenFunction · 0.90

Tested by

no test coverage detected