Skip to content

Commit ed820da

Browse files
committed
Tweaks to editFile tool
1 parent 5e1f457 commit ed820da

File tree

1 file changed

+10
-13
lines changed
  • src/vs/workbench/contrib/chat/browser/tools

1 file changed

+10
-13
lines changed

src/vs/workbench/contrib/chat/browser/tools/tools.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,18 @@ Avoid repeating existing code, instead use comments to represent regions of unch
5050
// ...existing code...
5151
5252
Here is an example of how you should format an edit to an existing Person class:
53-
class Person {
54-
// ...existing code...
55-
age: number;
56-
// ...existing code...
57-
getAge() {
58-
return this.age;
59-
}
53+
{
54+
"explanation": "Add an age property to the Person class",
55+
"filePath": "/folder/person.ts",
56+
"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 }"
6057
}
6158
`;
6259

6360
class EditTool implements IToolData, IToolImpl {
6461
readonly id = 'vscode_editFile';
6562
readonly tags = ['vscode_editing'];
6663
readonly displayName = localize('chat.tools.editFile', "Edit File");
67-
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}`;
64+
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}`;
6865
readonly inputSchema: IJSONSchema;
6966

7067
constructor(
@@ -75,20 +72,20 @@ class EditTool implements IToolData, IToolImpl {
7572
this.inputSchema = {
7673
type: 'object',
7774
properties: {
78-
filePath: {
79-
type: 'string',
80-
description: 'An absolute path to the file to edit',
81-
},
8275
explanation: {
8376
type: 'string',
8477
description: 'A short explanation of the edit being made. Can be the same as the explanation you showed to the user.',
8578
},
79+
filePath: {
80+
type: 'string',
81+
description: 'An absolute path to the file to edit',
82+
},
8683
code: {
8784
type: 'string',
8885
description: 'The code change to apply to the file. ' + codeInstructions
8986
}
9087
},
91-
required: ['filePath', 'explanation', 'code']
88+
required: ['explanation', 'filePath', 'code']
9289
};
9390
}
9491

0 commit comments

Comments
 (0)