File size: 858 Bytes
064bfd6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import type { ToolInput } from './useFilePermissionDialog.js'
export interface FileEdit {
old_string: string
new_string: string
replace_all?: boolean
}
export interface IDEDiffConfig {
filePath: string
edits?: FileEdit[]
editMode?: 'single' | 'multiple'
}
export interface IDEDiffChangeInput {
file_path: string
edits: FileEdit[]
}
export interface IDEDiffSupport<TInput extends ToolInput> {
getConfig(input: TInput): IDEDiffConfig
applyChanges(input: TInput, modifiedEdits: FileEdit[]): TInput
}
export function createSingleEditDiffConfig(
filePath: string,
oldString: string,
newString: string,
replaceAll?: boolean,
): IDEDiffConfig {
return {
filePath,
edits: [
{
old_string: oldString,
new_string: newString,
replace_all: replaceAll,
},
],
editMode: 'single',
}
}
|