diff --git a/src/vs/workbench/contrib/void/common/prompt/prompts.ts b/src/vs/workbench/contrib/void/common/prompt/prompts.ts index 71795a26..0e90fd92 100644 --- a/src/vs/workbench/contrib/void/common/prompt/prompts.ts +++ b/src/vs/workbench/contrib/void/common/prompt/prompts.ts @@ -44,12 +44,12 @@ const changesExampleContent = `\ // {{change 3}} // ... existing code ...` -const editToolDescriptionExample = `\ +const editToolDiffExample = `\ ${tripleTick[0]} ${changesExampleContent} ${tripleTick[1]}` -const fileNameEditExample = `${tripleTick[0]}typescript +const chatSuggestionDiffExample = `${tripleTick[0]}typescript /Users/username/Dekstop/my_project/app.ts ${changesExampleContent} ${tripleTick[1]}` @@ -91,6 +91,13 @@ const paginationParam = { // [K in keyof T as SnakeCase>]: T[K] // }; +const applyToolDescription = (type: 'edit tool' | 'chat suggestion') => `\ +${type === 'edit tool' ? 'A' : 'a'} code diff describing the change to make to the file. \ +Your DIFF is the only context that will be given to another LLM to apply the change, so it must be accurate and complete. \ +Your DIFF MUST be wrapped in triple backticks. \ +NEVER re-write the whole file. Always bias towards writing as little as possible. \ +Use comments like "// ... existing code ..." to condense your writing. \ +Here's an example of a good output:\n${type === 'edit tool' ? editToolDiffExample : chatSuggestionDiffExample}` export const voidTools = { @@ -206,13 +213,7 @@ export const voidTools = { params: { ...uriParam('file'), change_diff: { - description: `\ -A code diff describing the change to make to the file. \ -Your DIFF is the only context that will be given to another LLM to apply the change, so it must be accurate and complete. \ -Your DIFF MUST be wrapped in triple backticks. \ -NEVER re-write the whole file. Always bias towards writing as little as possible. \ -Use comments like "// ... existing code ..." to condense your writing. \ -Here's an example of a good output:\n${editToolDescriptionExample}` + description: applyToolDescription('edit tool') } }, }, @@ -330,16 +331,16 @@ Please assist the user with their query.`) - ${os} -- Open workspaces: -${workspaceFolders.join('\n') || 'NO WORKSPACE OPEN'} +- The user's workspace contains these folders: +${workspaceFolders.join('\n') || 'NO FOLDERS OPEN'} - Active file: ${activeURI} - Open files: -${openedURIs.join('\n') || 'NO OPENED EDITORS'}${''/* separator */}${mode === 'agent' && runningTerminalIds.length !== 0 ? ` +${openedURIs.join('\n') || 'NO OPENED FILES'}${''/* separator */}${mode === 'agent' && runningTerminalIds.length !== 0 ? ` -- Existing terminal IDs: ${runningTerminalIds.join(', ')}` : ''} +- Existing persistent terminal IDs: ${runningTerminalIds.join(', ')}` : ''} `) @@ -369,7 +370,7 @@ ${directoryStr} details.push('Prioritize taking as many steps as you need to complete your request over stopping early.') details.push(`You will OFTEN need to gather context before making a change. Do not immediately make a change unless you have ALL relevant context.`) details.push(`ALWAYS have maximal certainty in a change BEFORE you make it. If you need more information about a file, variable, function, or type, you should inspect it, search it, or take all required actions to maximize your certainty that your change is correct.`) - details.push(`NEVER modify a file outside the user's workspace(s) without permission from the user.`) + details.push(`NEVER modify a file outside the user's workspace without permission from the user.`) } if (mode === 'gather') { @@ -384,12 +385,8 @@ ${directoryStr} - The remaining contents of the file should proceed as usual.`) details.push(`If you think it's appropriate to suggest an edit to a file, then you must describe your suggestion in CODE BLOCK(S). -- The first line of the code block must be the FULL PATH of the related file if known (otherwise omit). -- The remaining contents should be \ -a brief code description of the change you want to make, with comments like "// ... existing code ..." to condense your writing. \ -NEVER re-write the whole file. Instead, use comments like "// ... existing code ...". Bias towards writing as little as possible. \ -Here's an example of a good edit suggestion: -${fileNameEditExample}.`) +- The first line of the code block must be the FULL PATH of the related file. +- The remaining contents should be ${applyToolDescription('chat suggestion')}`) } details.push(`NEVER write the FULL PATH of a file when speaking with the user. Just write the file name ONLY.`)