From ed3d4d5ed966e7e92b04210a38953a66034e2fec Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 10 Apr 2024 23:08:40 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20configure=20context=20menu=20prompt?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/index.d.ts | 16 ++++++++++ docs/static/schemas/config.json | 32 +++++++++++++++++++ .../src/main/resources/config_schema.json | 32 +++++++++++++++++++ extensions/vscode/config_schema.json | 32 +++++++++++++++++++ extensions/vscode/continue_rc_schema.json | 32 +++++++++++++++++++ extensions/vscode/src/commands.ts | 18 ++++++++--- extensions/vscode/yarn.lock | 5 +++ 7 files changed, 162 insertions(+), 5 deletions(-) diff --git a/core/index.d.ts b/core/index.d.ts index 5134ccdce..2d5dc0684 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -678,6 +678,17 @@ export interface ContinueUIConfig { codeBlockToolbarPosition?: "top" | "bottom"; } +interface ContextMenuConfig { + comment?: string; + docstring?: string; + fix?: string; + optimize?: string; + fixGrammar?: string; +} +interface ExperimantalConfig { + contextMenuPrompts?: ContextMenuConfig; +} + export interface SerializedContinueConfig { env?: string[]; allowAnonymousTelemetry?: boolean; @@ -695,6 +706,7 @@ export interface SerializedContinueConfig { tabAutocompleteOptions?: Partial; ui?: ContinueUIConfig; reranker?: RerankerDescription; + experimental?: ExperimantalConfig; } export type ConfigMergeType = "merge" | "overwrite"; @@ -737,6 +749,8 @@ export interface Config { ui?: ContinueUIConfig; /** Options for the reranker */ reranker?: RerankerDescription | Reranker; + /** Experimental configuration */ + experimental?: ExperimantalConfig; } export interface ContinueConfig { @@ -754,6 +768,7 @@ export interface ContinueConfig { tabAutocompleteOptions?: Partial; ui?: ContinueUIConfig; reranker?: Reranker; + experimental?: ExperimantalConfig; } export interface BrowserSerializedContinueConfig { @@ -769,4 +784,5 @@ export interface BrowserSerializedContinueConfig { embeddingsProvider?: string; ui?: ContinueUIConfig; reranker?: RerankerDescription; + experimental?: ExperimantalConfig; } diff --git a/docs/static/schemas/config.json b/docs/static/schemas/config.json index fc93e78da..fff595834 100644 --- a/docs/static/schemas/config.json +++ b/docs/static/schemas/config.json @@ -1807,6 +1807,38 @@ "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." } } + }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } } } } diff --git a/extensions/intellij/src/main/resources/config_schema.json b/extensions/intellij/src/main/resources/config_schema.json index fc93e78da..fff595834 100644 --- a/extensions/intellij/src/main/resources/config_schema.json +++ b/extensions/intellij/src/main/resources/config_schema.json @@ -1807,6 +1807,38 @@ "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." } } + }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } } } } diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index fc93e78da..fff595834 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1807,6 +1807,38 @@ "description": "Whether to show the copy and apply code buttons at the top or bottom of code blocks in the sidebar." } } + }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } } } } diff --git a/extensions/vscode/continue_rc_schema.json b/extensions/vscode/continue_rc_schema.json index 94d5db570..d1cbb3d42 100644 --- a/extensions/vscode/continue_rc_schema.json +++ b/extensions/vscode/continue_rc_schema.json @@ -2041,6 +2041,38 @@ } } }, + "experimental": { + "type": "object", + "title": "Experimental", + "description": "Experimental properties are subject to change.", + "properties": { + "contextMenuPrompts": { + "type": "object", + "properties": { + "comment": { + "type": "string", + "default": "Write comments for this code. Do not change anything about the code itself." + }, + "docstring": { + "type": "string", + "default": "Write a docstring for this code. Do not change anything about the code itself." + }, + "fix": { + "type": "string", + "default": "Fix this code" + }, + "optimize": { + "type": "string", + "default": "Optimize this code" + }, + "fixGrammar": { + "type": "string", + "default": "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing." + } + } + } + } + }, "mergeBehavior": { "type": "string", "enum": [ diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index ac0f299bc..c026b72da 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -268,31 +268,39 @@ const commandsMap: ( }, "continue.writeCommentsForCode": async () => { await verticalDiffManager.streamEdit( - "Write comments for this code. Do not change anything about the code itself.", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.comment || + "Write comments for this code. Do not change anything about the code itself.", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.writeDocstringForCode": async () => { await verticalDiffManager.streamEdit( - "Write a docstring for this code. Do not change anything about the code itself.", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.docstring || + "Write a docstring for this code. Do not change anything about the code itself.", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.fixCode": async () => { await verticalDiffManager.streamEdit( - "Fix this code", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.fix || "Fix this code", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.optimizeCode": async () => { await verticalDiffManager.streamEdit( - "Optimize this code", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.optimize || "Optimize this code", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, "continue.fixGrammar": async () => { await verticalDiffManager.streamEdit( - "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing.", + (await configHandler.loadConfig()).experimental?.contextMenuPrompts + ?.fixGrammar || + "If there are any grammar or spelling mistakes in this writing, fix them. Do not make other large changes to the writing.", await sidebar.webviewProtocol.request("getDefaultModelTitle", undefined), ); }, diff --git a/extensions/vscode/yarn.lock b/extensions/vscode/yarn.lock index 6e49e51c9..07f331801 100644 --- a/extensions/vscode/yarn.lock +++ b/extensions/vscode/yarn.lock @@ -691,6 +691,11 @@ resolved "https://registry.npmjs.org/@jsdevtools/ono/-/ono-7.1.3.tgz" integrity sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg== +"@lancedb/vectordb-darwin-arm64@*": + version "0.4.16" + resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.16.tgz" + integrity sha512-RtuizzrZIVDYQ4ZZIMQRHGuV0DvOV93lyvivJJBLP1zCORMHEtEduaVbFE/+H0OCo0oqPsKXEpbc0nUEXKQqRg== + "@lancedb/vectordb-darwin-arm64@0.4.12": version "0.4.12" resolved "https://registry.npmjs.org/@lancedb/vectordb-darwin-arm64/-/vectordb-darwin-arm64-0.4.12.tgz"