diff --git a/product.json b/product.json
index a35f197c..d892feaf 100644
--- a/product.json
+++ b/product.json
@@ -31,6 +31,10 @@
"nodejsRepository": "https://nodejs.org",
"urlProtocol": "code-oss",
"webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/",
+ "extensionsGallery": {
+ "serviceUrl": "https://open-vsx.org/vscode/gallery",
+ "itemUrl": "https://open-vsx.org/vscode/item"
+ },
"builtInExtensions": [
{
"name": "ms-vscode.js-debug-companion",
diff --git a/src/vs/workbench/contrib/void/browser/helpers/reactServicesHelper.ts b/src/vs/workbench/contrib/void/browser/helpers/reactServicesHelper.ts
index 3c043344..08ad3fdb 100644
--- a/src/vs/workbench/contrib/void/browser/helpers/reactServicesHelper.ts
+++ b/src/vs/workbench/contrib/void/browser/helpers/reactServicesHelper.ts
@@ -9,10 +9,12 @@ import { ILLMMessageService } from '../../../../../platform/void/common/llmMessa
import { IRefreshModelService } from '../../../../../platform/void/common/refreshModelService.js';
import { IVoidSettingsService } from '../../../../../platform/void/common/voidSettingsService.js';
import { IInlineDiffsService } from '../inlineDiffsService.js';
+import { IQuickEditStateService } from '../quickEditStateService.js';
import { ISidebarStateService } from '../sidebarStateService.js';
import { IThreadHistoryService } from '../threadHistoryService.js';
export type ReactServicesType = {
+ quickEditStateService: IQuickEditStateService;
sidebarStateService: ISidebarStateService;
settingsStateService: IVoidSettingsService;
threadsStateService: IThreadHistoryService;
@@ -33,6 +35,7 @@ export type ReactServicesType = {
export const getReactServices = (accessor: ServicesAccessor): ReactServicesType => {
return {
+ quickEditStateService: accessor.get(IQuickEditStateService),
settingsStateService: accessor.get(IVoidSettingsService),
sidebarStateService: accessor.get(ISidebarStateService),
threadsStateService: accessor.get(IThreadHistoryService),
diff --git a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts
index 5d6c0c49..e33c9991 100644
--- a/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts
+++ b/src/vs/workbench/contrib/void/browser/inlineDiffsService.ts
@@ -11,7 +11,7 @@ import { ICodeEditor, IOverlayWidget, IViewZone } from '../../../../editor/brows
// import { IUndoRedoService } from '../../../../platform/undoRedo/common/undoRedo.js';
import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js';
// import { throttle } from '../../../../base/common/decorators.js';
-import { writeFileWithDiffInstructions } from './prompt/systemPrompts.js';
+import { writeFileWithDiffInstructions } from './prompt/prompts.js';
import { ComputedDiff, findDiffs } from './helpers/findDiffs.js';
import { EndOfLinePreference, ITextModel } from '../../../../editor/common/model.js';
import { IRange } from '../../../../editor/common/core/range.js';
diff --git a/src/vs/workbench/contrib/void/browser/prompt/systemPrompts.ts b/src/vs/workbench/contrib/void/browser/prompt/prompts.ts
similarity index 71%
rename from src/vs/workbench/contrib/void/browser/prompt/systemPrompts.ts
rename to src/vs/workbench/contrib/void/browser/prompt/prompts.ts
index 157f4292..803029c2 100644
--- a/src/vs/workbench/contrib/void/browser/prompt/systemPrompts.ts
+++ b/src/vs/workbench/contrib/void/browser/prompt/prompts.ts
@@ -3,37 +3,144 @@
* Void Editor additions licensed under the AGPL 3.0 License.
*--------------------------------------------------------------------------------------------*/
-// // used for ctrl+l
-// const partialGenerationInstructions = ``
+
+import { CodeSelection } from '../threadHistoryService.js';
+
+const stringifySelections = (selections: CodeSelection[]) => {
+
+ return selections.map(({ fileURI, content, selectionStr }) =>
+ `\
+File: ${fileURI.fsPath}
+\`\`\`
+${content // this was the enite file which is foolish
+ }
+\`\`\`${selectionStr === null ? '' : `
+Selection: ${selectionStr}`}
+`).join('\n')
+}
-// // used for ctrl+k, autocomplete
-// const fimInstructions = ``
+export const generateCtrlLPrompt = (instructions: string, selections: CodeSelection[] | null) => {
+ let str = '';
+ if (selections && selections.length > 0) {
+ str += stringifySelections(selections);
+ str += `Please edit the selected code following these instructions:\n`
+ }
+ str += `${instructions}`;
+ return str;
+};
-// CTRL+K prompt:
-// const promptContent = `Here is the user's original selection:
-// \`\`\`
-// ${selection}
-// \`\`\`
-// The user wants to apply the following instructions to the selection:
-// ${instructions}
+export const ctrlLSystem = `\
+You are a coding assistant. You are given a list of relevant files \`files\`, a selection that the user is making \`selection\`, and instructions to follow \`instructions\`.
-// Please rewrite the selection following the user's instructions.
+Please edit the selected file following the user's instructions (or, if appropriate, answer their question instead).
-// Instructions to follow:
-// 1. Follow the user's instructions
-// 2. You may ONLY CHANGE the selection, and nothing else in the file
-// 3. Make sure all brackets in the new selection are balanced the same was as in the original selection
-// 3. Be careful not to duplicate or remove variables, comments, or other syntax by mistake
+Instructions:
+1. Output the changes to make to the entire file.
+1. Do not re-write the entire file.
+3. Instead, you may use code elision to represent unchanged portions of code. For example, write "existing code..." in code comments.
+4. You must give enough context to apply the change in the correct location.
-// Complete the following:
-// \`\`\`
-//
${prefix}
-// ${suffix}
-// `;
+## EXAMPLE
+FILES
+selected file \`math.ts\`:
+\`\`\`
+const addNumbers = (a, b) => a + b
+const subtractNumbers = (a, b) => a - b
+const divideNumbers = (a, b) => a / b
+\`\`\`
+
+SELECTION
+\`\`\`
+const subtractNumbers = (a, b) => a - b
+\`\`\`
+
+INSTRUCTIONS
+\`\`\`
+add a function that multiplies numbers below this
+\`\`\`
+
+EXPECTED OUTPUT
+We can add the following code to the file:
+\`\`\`
+// existing code...
+const subtractNumbers = (a, b) => a - b;
+const multiplyNumbers = (a, b) => a * b;
+// existing code...
+\`\`\`
+
+## EXAMPLE
+
+FILES
+selected file \`fib.ts\`:
+\`\`\`
+
+const dfs = (root) => {
+ if (!root) return;
+ console.log(root.val);
+ dfs(root.left);
+ dfs(root.right);
+}
+const fib = (n) => {
+ if (n < 1) return 1
+ return fib(n - 1) + fib(n - 2)
+}
+\`\`\`
+
+SELECTION
+\`\`\`
+ return fib(n - 1) + fib(n - 2)
+\`\`\`
+
+INSTRUCTIONS
+\`\`\`
+memoize results
+\`\`\`
+
+EXPECTED OUTPUT
+To implement memoization in your Fibonacci function, you can use a JavaScript object to store previously computed results. This will help avoid redundant calculations and improve performance. Here's how you can modify your function:
+\`\`\`
+// existing code...
+const fib = (n, memo = {}) => {
+ if (n < 1) return 1;
+ if (memo[n]) return memo[n]; // Check if result is already computed
+ memo[n] = fib(n - 1, memo) + fib(n - 2, memo); // Store result in memo
+ return memo[n];
+}
+\`\`\`
+Explanation:
+Memoization Object: A memo object is used to store the results of Fibonacci calculations for each n.
+Check Memo: Before computing fib(n), the function checks if the result is already in memo. If it is, it returns the stored result.
+Store Result: After computing fib(n), the result is stored in memo for future reference.
+
+## END EXAMPLES\
+`
+
+export const generateCtrlKPrompt = ({ selection, prefix, suffix, instructions, }: { selection: string, prefix: string, suffix: string, instructions: string, }) => `\
+Here is the user's original selection:
+\`\`\`
+${selection}
+\`\`\`
+
+The user wants to apply the following instructions to the selection:
+${instructions}
+
+Please rewrite the selection following the user's instructions.
+
+Instructions to follow:
+1. Follow the user's instructions
+2. You may ONLY CHANGE the selection, and nothing else in the file
+3. Make sure all brackets in the new selection are balanced the same was as in the original selection
+3. Be careful not to duplicate or remove variables, comments, or other syntax by mistake
+
+Complete the following:
+\`\`\`
+