diff options
| author | Eddie Santos <[email protected]> | 2025-06-09 16:01:06 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-06-09 16:01:06 -0700 |
| commit | 6484dc9008448637ebdebd21f83d876aaac127c8 (patch) | |
| tree | 2787f9d14a35ae8ac1a545034ffc472cb2352684 /packages/core/src/tools/edit.ts | |
| parent | 5c9e526f0e967afe75c4948e4b077db286f626f2 (diff) | |
Add Windsurf in edit tool to modify changes, if installed (#853)
Diffstat (limited to 'packages/core/src/tools/edit.ts')
| -rw-r--r-- | packages/core/src/tools/edit.ts | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/packages/core/src/tools/edit.ts b/packages/core/src/tools/edit.ts index fdabc5b6..cb569f80 100644 --- a/packages/core/src/tools/edit.ts +++ b/packages/core/src/tools/edit.ts @@ -25,6 +25,7 @@ import { ensureCorrectEdit } from '../utils/editCorrector.js'; import { DEFAULT_DIFF_OPTIONS } from './diffOptions.js'; import { openDiff } from '../utils/editor.js'; import { ReadFileTool } from './read-file.js'; +import { EditorType } from '../utils/editor.js'; /** * Parameters for the Edit tool @@ -467,6 +468,19 @@ Expectation for required parameters: } } + async getEditor(outcome: ToolConfirmationOutcome): Promise<EditorType> { + switch (outcome) { + case ToolConfirmationOutcome.ModifyVSCode: + return 'vscode'; + case ToolConfirmationOutcome.ModifyWindsurf: + return 'windsurf'; + case ToolConfirmationOutcome.ModifyCursor: + return 'cursor'; + default: + return 'vim'; + } + } + /** * Creates temp files for the current and proposed file contents and opens a diff tool. * When the diff tool is closed, the tool will check if the file has been modified and provide the updated params. @@ -483,11 +497,9 @@ Expectation for required parameters: this.tempOldDiffPath = oldPath; this.tempNewDiffPath = newPath; - await openDiff( - this.tempOldDiffPath, - this.tempNewDiffPath, - outcome === ToolConfirmationOutcome.ModifyVSCode ? 'vscode' : 'vim', - ); + const editor = await this.getEditor(outcome); + + await openDiff(this.tempOldDiffPath, this.tempNewDiffPath, editor); return await this.getUpdatedParamsIfModified(params, _abortSignal); } |
