Skip to content

Commit

Permalink
Tweaks to editFile tool
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jan 13, 2025
1 parent 5e1f457 commit ed820da
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/vs/workbench/contrib/chat/browser/tools/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,18 @@ Avoid repeating existing code, instead use comments to represent regions of unch
// ...existing code...
Here is an example of how you should format an edit to an existing Person class:
class Person {
// ...existing code...
age: number;
// ...existing code...
getAge() {
return this.age;
}
{
"explanation": "Add an age property to the Person class",
"filePath": "/folder/person.ts",
"code": "// ...existing code...\n class Person {\n // ...existing code...\n age: number;\n // ...existing code...\n getAge() {\n return this.age;\n }\n // ...existing code...\n }"
}
`;

class EditTool implements IToolData, IToolImpl {
readonly id = 'vscode_editFile';
readonly tags = ['vscode_editing'];
readonly displayName = localize('chat.tools.editFile', "Edit File");
readonly modelDescription = `Edit a file in the workspace. Use this tool once per file that needs to be modified, even if there are multiple changes for a file. ${codeInstructions}`;
readonly modelDescription = `Edit a file in the workspace. Use this tool once per file that needs to be modified, even if there are multiple changes for a file. Generate the "explanation" property first. ${codeInstructions}`;
readonly inputSchema: IJSONSchema;

constructor(
Expand All @@ -75,20 +72,20 @@ class EditTool implements IToolData, IToolImpl {
this.inputSchema = {
type: 'object',
properties: {
filePath: {
type: 'string',
description: 'An absolute path to the file to edit',
},
explanation: {
type: 'string',
description: 'A short explanation of the edit being made. Can be the same as the explanation you showed to the user.',
},
filePath: {
type: 'string',
description: 'An absolute path to the file to edit',
},
code: {
type: 'string',
description: 'The code change to apply to the file. ' + codeInstructions
}
},
required: ['filePath', 'explanation', 'code']
required: ['explanation', 'filePath', 'code']
};
}

Expand Down

0 comments on commit ed820da

Please sign in to comment.