From adcede0ac8f7d41dc6fb22479f623f46a71df0c7 Mon Sep 17 00:00:00 2001 From: tim-jagenberg-piscada <77322574+tim-jagenberg-piscada@users.noreply.github.com> Date: Fri, 24 Jan 2025 10:24:32 +0100 Subject: [PATCH 01/25] remove duplicate `/` in VertexAI _embed Removed duplicate `/` and aligned `new URL(...` usage with the rest of the file. --- core/llm/llms/VertexAI.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index 8d20c3212..4d52e5c43 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -445,7 +445,7 @@ class VertexAI extends BaseLLM { } const resp = await this.fetch( - new URL(this.apiBase + `/publishers/google/models/${this.model}:predict`), + new URL(`publishers/google/models/${this.model}:predict`, this.apiBase), { method: "POST", body: JSON.stringify({ From f28031902f41c4ae9f7cab01398216272950b7d0 Mon Sep 17 00:00:00 2001 From: liuk Date: Sat, 25 Jan 2025 17:46:16 +0800 Subject: [PATCH 02/25] fix: Handle empty addedLines in revertDiff --- .../continueintellijextension/editor/VerticalDiffBlock.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt index 6f311c29b..627b89d4a 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/VerticalDiffBlock.kt @@ -192,10 +192,12 @@ class VerticalDiffBlock( private fun revertDiff() { WriteCommandAction.runWriteCommandAction(project) { - // Delete the added lines val startOffset = editor.document.getLineStartOffset(startLine) - val endOffset = editor.document.getLineEndOffset(startLine + addedLines.size - 1) + 1 - editor.document.deleteString(startOffset, endOffset) + // Delete the added lines + if (addedLines.isNotEmpty()) { + val endOffset = editor.document.getLineEndOffset(startLine + addedLines.size - 1) + 1 + editor.document.deleteString(startOffset, endOffset) + } // Add the deleted lines back if (deletedLines.isNotEmpty()) { From 9910fc17225526973f65097f75f50456b35ddef0 Mon Sep 17 00:00:00 2001 From: Lukas Kreussel Date: Wed, 12 Feb 2025 12:05:46 +0100 Subject: [PATCH 03/25] Allow articels without `h2` tags --- core/indexing/docs/article.ts | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/core/indexing/docs/article.ts b/core/indexing/docs/article.ts index 428bae967..aba1da6b0 100644 --- a/core/indexing/docs/article.ts +++ b/core/indexing/docs/article.ts @@ -139,24 +139,35 @@ export async function htmlPageToArticleWithChunks( return undefined; } + const title = readability.title || subpath; + const titles = Array.from(dom.window.document.querySelectorAll("h2")); - const article_components = titles.map((titleElement) => { - const title = titleElement.textContent || ""; - let body = ""; - let nextSibling = titleElement.nextElementSibling; - while (nextSibling && nextSibling.tagName !== "H2") { - body += nextSibling.textContent || ""; - nextSibling = nextSibling.nextElementSibling; - } + const article_components = + titles.length > 0 + ? titles.map((titleElement) => { + const title = titleElement.textContent || ""; + let body = ""; + let nextSibling = titleElement.nextElementSibling; - return { title, body }; - }); + while (nextSibling && nextSibling.tagName !== "H2") { + body += nextSibling.textContent || ""; + nextSibling = nextSibling.nextElementSibling; + } + + return { title, body }; + }) + : [ + { + title: title, + body: readability.textContent, + }, + ]; const article = { url, subpath, - title: readability.title, + title: title, article_components, }; return { From f358d0a27321e69e6d49c03ac2a922cff3cd249b Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Wed, 12 Feb 2025 14:43:28 +0100 Subject: [PATCH 04/25] Fix cross-platform prepackaging failing to copy start_ollama.sh Signed-off-by: Fred Bricon --- extensions/vscode/scripts/utils.js | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/extensions/vscode/scripts/utils.js b/extensions/vscode/scripts/utils.js index 4f9ce187c..9cbe62455 100644 --- a/extensions/vscode/scripts/utils.js +++ b/extensions/vscode/scripts/utils.js @@ -508,21 +508,11 @@ async function installNodeModuleInTempDirAndCopyToCurrent(packageName, toCopy) { async function copyScripts() { process.chdir(path.join(continueDir, "extensions", "vscode")); console.log("[info] Copying scripts from core"); - await new Promise((resolve, reject) => { - ncp( - path.join(__dirname, "../../../core/scripts"), - path.join(__dirname, "../out"), - { dereference: true }, - (error) => { - if (error) { - console.warn("[error] Error copying script files", error); - reject(error); - } else { - resolve(); - } - }, - ); - }); + fs.copyFileSync( + path.join(__dirname, "../../../core/util/start_ollama.sh"), + path.join(__dirname, "../out/start_ollama.sh"), + ); + console.log("[info] Copied script files"); } module.exports = { From e23a5db71403e65e37938147f688d03abe9b8712 Mon Sep 17 00:00:00 2001 From: Adam Shedivy Date: Wed, 12 Feb 2025 13:50:29 -0600 Subject: [PATCH 05/25] Add method to retrieve submenu context provider titles and update messenger on change --- core/config/ConfigHandler.ts | 11 +++++++++++ core/core.ts | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index 9d2899153..62a8e4963 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -82,6 +82,17 @@ export class ConfigHandler { void this.init(); } + /** + * Retrieves the titles of additional context providers that are of type "submenu". + * + * @returns {string[]} An array of titles of the additional context providers that have a description type of "submenu". + */ + getAdditionalSubmenuContextProviders(): string[] { + return this.additionalContextProviders + .filter(provider => provider.description.type === "submenu") + .map(provider => provider.description.title); + } + private async init() { const workspaceId = await this.getWorkspaceId(); const lastSelectedOrgIds = diff --git a/core/core.ts b/core/core.ts index 74b53f833..955758aaf 100644 --- a/core/core.ts +++ b/core/core.ts @@ -138,6 +138,11 @@ export class Core { result: serializedResult, profileId: this.configHandler.currentProfile.profileDescription.id, }); + + // update additional submenu context providers registered via VSCode API + this.messenger.send("refreshSubmenuItems", { + providers: this.configHandler.getAdditionalSubmenuContextProviders() + }); }); this.configHandler.onDidChangeAvailableProfiles((profiles) => From de842ea51cd149e25c3782fb1f9512b0c6ee5a30 Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Fri, 14 Feb 2025 09:10:00 +0100 Subject: [PATCH 06/25] docs: add Django to the pre indexed docs --- core/indexing/docs/preIndexedDocs.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/indexing/docs/preIndexedDocs.ts b/core/indexing/docs/preIndexedDocs.ts index 4b0c12fee..5342396fd 100644 --- a/core/indexing/docs/preIndexedDocs.ts +++ b/core/indexing/docs/preIndexedDocs.ts @@ -358,6 +358,11 @@ const preIndexedDocs: Record< startUrl: "https://angular.dev/", rootUrl: "https://angular.dev/", }, + "https://docs.djangoproject.com/": { + title: "Django", + startUrl: "https://docs.djangoproject.com/", + rootUrl: "https://docs.djangoproject.com/", + } }; export default preIndexedDocs; From 71186117ef4e437d6940ab12068baf89edba6500 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sat, 8 Feb 2025 14:24:55 -0500 Subject: [PATCH 07/25] Autocomplete: make Granite 3 detection broader The Granite 3 models on Hugging Face use names like: https://huggingface.co/ibm-granite/granite-3.1-8b-instruct Compared to: https://ollama.com/library/granite3.1-dense Use the hole-filler template for names with or without the dash. --- core/autocomplete/templating/AutocompleteTemplate.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/autocomplete/templating/AutocompleteTemplate.ts b/core/autocomplete/templating/AutocompleteTemplate.ts index 7f5366df0..2c8b12a31 100644 --- a/core/autocomplete/templating/AutocompleteTemplate.ts +++ b/core/autocomplete/templating/AutocompleteTemplate.ts @@ -399,7 +399,8 @@ export function getTemplateForModel(model: string): AutocompleteTemplate { lowerCaseModel.includes("gpt") || lowerCaseModel.includes("davinci-002") || lowerCaseModel.includes("claude") || - lowerCaseModel.includes("granite3") + lowerCaseModel.includes("granite3") || + lowerCaseModel.includes("granite-3") ) { return holeFillerTemplate; } From b076be7b791d38737bf0484558b6ffa65c142645 Mon Sep 17 00:00:00 2001 From: ferenci84 Date: Sat, 15 Feb 2025 14:43:13 +0100 Subject: [PATCH 08/25] Add package to tasks.json --- .vscode/tasks.json | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e3250d80a..110f01fae 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -73,7 +73,27 @@ } ] }, - // Build the React app. It gets bundled into the extension as a file resource and has a seprate build step + { + "label": "vscode-extension:package", + "dependsOn": ["vscode-extension:esbuild"], + "type": "npm", + "script": "package", + "path": "extensions/vscode", + "problemMatcher": [ + { + "pattern": [ + { + "regexp": "> (.*?):([0-9]+):([0-9]+): (warning|error): (.+)$", + "file": 1, + "line": 2, + "column": 3, + "severity": 4, + "message": 5 + } + ] + } + ] + }, { "label": "vscode-extension:continue-ui:build", "type": "shell", From ac282093fa4cc67a5cee432c21781a0915f9e3e5 Mon Sep 17 00:00:00 2001 From: ferenci84 Date: Sat, 15 Feb 2025 17:55:13 +0100 Subject: [PATCH 09/25] update extension packaging instructions in CONTRIBUTING.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b69b1fd44..4f7e1634f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,7 +128,7 @@ nvm use 1. The new VS Code window with the extension is referred to as the _Host VS Code_ 2. The window you started debugging from is referred to as the _Main VS Code_ -3. To package the extension, run `npm run package` in the `extensions/vscode` directory. This will generate `extensions/vscode/build/continue-{VERSION}.vsix`, which you can install by right-clicking and selecting "Install Extension VSIX". +3. To package the extension, run `npm run package` in the `extensions/vscode` directory, select `Tasks: Run Task` and then select `vscode-extension:package`. This will generate `extensions/vscode/build/continue-{VERSION}.vsix`, which you can install by right-clicking and selecting "Install Extension VSIX". ##### Debugging From d57c315effefd88d8872d21b39c03c88ca97d6d2 Mon Sep 17 00:00:00 2001 From: AkatQuas <295140755@qq.com> Date: Mon, 17 Feb 2025 19:17:16 +0800 Subject: [PATCH 10/25] chore: small typo --- .continue/prompts/core-unit-test.prompt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.continue/prompts/core-unit-test.prompt b/.continue/prompts/core-unit-test.prompt index 42ecef7bb..1a08945b4 100644 --- a/.continue/prompts/core-unit-test.prompt +++ b/.continue/prompts/core-unit-test.prompt @@ -4,7 +4,7 @@ description: Generate unit tests for core utilities Write jest tests for the provided code. Use jest version ^29 (e.g. jest 29.7.0) -Use best practices. Be clear and consise. +Use best practices. Be clear and concise. Aim for 100% code coverage where reasonable. Multiple tests can be written, split up tests for best clarity and readability. Only use typescript, and if the file/code is not typescript, warn the user. @@ -15,7 +15,7 @@ Use double quotes (or backticks if needed) for strings The code being tested is used in IDE extensions, and it: - accesses code workspaces through the IDE ("workspace directories") - persists extension-related data to the the local machine of the user ("global directory"), and -- uses configuration via a `ConfigHandler`, which is stored in either the global directory (default) or accesed via a remote "control plane" using the `ControlPlaneClient` +- uses configuration via a `ConfigHandler`, which is stored in either the global directory (default) or accessed via a remote "control plane" using the `ControlPlaneClient` Jest testing setup includes - @core/test/jest.global-setup.ts initializes a temporary global directory, which is where files that store persisted extension data live. @@ -31,7 +31,7 @@ Jest testing setup includes Do NOT write tests for any files in `core/test`, only use them as helpers for testing other files. If no other files are provided, warn the user and write no tests. -IMPORTANT: Do NOT mock the fixtures above other than using `jest.spyOn`. DO mock 3rd party modules, etc. when sensible. +IMPORTANT: Do NOT mock the fixtures above other than using `jest.spyOn`. DO mock 3rd party modules, etc. when sensible. Instead, generate actual mock files and data for operations Pure mocks should only be used to emulate specific network responses/error or hard-to-duplicate errors, or to prevent long-duration tests From eb06857124f5dd88552407a69ea0b4cfaf37264b Mon Sep 17 00:00:00 2001 From: VisualPlugin Date: Wed, 19 Feb 2025 01:01:43 +0000 Subject: [PATCH 11/25] Update AutocompleteLanguageInfo.ts --- .../autocomplete/constants/AutocompleteLanguageInfo.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/autocomplete/constants/AutocompleteLanguageInfo.ts b/core/autocomplete/constants/AutocompleteLanguageInfo.ts index d51fe1f1f..82b169677 100644 --- a/core/autocomplete/constants/AutocompleteLanguageInfo.ts +++ b/core/autocomplete/constants/AutocompleteLanguageInfo.ts @@ -240,6 +240,14 @@ export const Solidity = { endOfLine: [";"], }; +// Lua +export const Lua = { + name: "Lua", + topLevelKeywords: ["function"], + singleLineComment: "--", + endOfLine: [], +}; + // YAML export const YAML: AutocompleteLanguageInfo = { name: "YAML", @@ -367,6 +375,8 @@ export const LANGUAGES: { [extension: string]: AutocompleteLanguageInfo } = { yaml: YAML, yml: YAML, md: Markdown, + lua: Lua, + luau: Lua, }; export function languageForFilepath(fileUri: string): AutocompleteLanguageInfo { From 166e2b728de21536f3065ee7c12feb6fab31d121 Mon Sep 17 00:00:00 2001 From: VisualPlugin Date: Wed, 19 Feb 2025 01:06:02 +0000 Subject: [PATCH 12/25] Update treeSitter.ts --- core/util/treeSitter.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/core/util/treeSitter.ts b/core/util/treeSitter.ts index 067445994..df1296e0c 100644 --- a/core/util/treeSitter.ts +++ b/core/util/treeSitter.ts @@ -93,6 +93,7 @@ export const supportedLanguages: { [key: string]: LanguageName } = { htm: LanguageName.HTML, java: LanguageName.JAVA, lua: LanguageName.LUA, + luau: LanguageName.LUA, ocaml: LanguageName.OCAML, ml: LanguageName.OCAML, mli: LanguageName.OCAML, From 37cc48a8c417fe6fb9752673c7faa5eb52c1b1f6 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:08:12 -0800 Subject: [PATCH 13/25] show toolbar immediately upon clicking --- gui/src/components/mainInput/InputToolbar.tsx | 1 - .../components/mainInput/InputToolbar/ToggleToolsButton.tsx | 6 +++--- gui/src/components/mainInput/TipTapEditor.tsx | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index a6b92ab90..2ffd52a48 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -110,7 +110,6 @@ function InputToolbar(props: InputToolbarProps) {
diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 3265b2778..119639045 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -82,8 +82,8 @@ export default function ToolDropdown(props: ToolDropdownProps) { {}} - as="div" - onClick={(e) => e.stopPropagation()} + // as="div" + // onClick={(e) => e.stopPropagation()} disabled={props.disabled} > {({ open }) => ( @@ -101,7 +101,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { setDropdownOpen(false)} + // afterLeave={() => setDropdownOpen(false)} > { setShouldHideToolbar(value); - }, 200); + }, 1000); function getPlaceholderText( placeholder: TipTapEditorProps["placeholder"], @@ -591,7 +591,7 @@ function TipTapEditor(props: TipTapEditorProps) { useEffect(() => { if (editor) { const handleFocus = () => { - debouncedShouldHideToolbar(false); + setShouldHideToolbar(false); }; const handleBlur = () => { From 661b07a9faa51818709af295ba835023bcccd049 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:21:29 -0800 Subject: [PATCH 14/25] tweaks --- .../components/mainInput/InputToolbar/ToggleToolsButton.tsx | 6 +++--- gui/src/components/mainInput/TipTapEditor.tsx | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 119639045..3fa0d4447 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -82,8 +82,8 @@ export default function ToolDropdown(props: ToolDropdownProps) { {}} - // as="div" - // onClick={(e) => e.stopPropagation()} + as="div" + onClick={(e) => e.stopPropagation()} disabled={props.disabled} > {({ open }) => ( @@ -147,7 +147,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { />
-
+
{availableTools.map((tool: any) => ( { - debouncedShouldHideToolbar(true); + // TODO - make toolbar auto-hiding work without breaking tool dropdown focus + // debouncedShouldHideToolbar(true); }; editor.on("focus", handleFocus); From c10e54da870094d648003442aa3ddc5bc5df53fa Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:23:28 -0800 Subject: [PATCH 15/25] cleanup --- gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx | 2 +- gui/src/components/mainInput/TipTapEditor.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 3fa0d4447..c20d1810f 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -101,7 +101,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { setDropdownOpen(false)} + afterLeave={() => setDropdownOpen(false)} > { setShouldHideToolbar(value); - }, 1000); + }, 200); function getPlaceholderText( placeholder: TipTapEditorProps["placeholder"], From b60b671a54a8e5bbdf25d458a2268a36759e4965 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:38:33 -0800 Subject: [PATCH 16/25] query context provider focus issue fixes --- gui/src/components/mainInput/MentionList.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gui/src/components/mainInput/MentionList.tsx b/gui/src/components/mainInput/MentionList.tsx index 323b586d0..94324b75e 100644 --- a/gui/src/components/mainInput/MentionList.tsx +++ b/gui/src/components/mainInput/MentionList.tsx @@ -257,7 +257,7 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { if (queryInputRef.current) { queryInputRef.current.focus(); } - }, [querySubmenuItem]); + }, [querySubmenuItem, queryInputRef]); const selectItem = (index: number) => { const item = allItems[index]; @@ -378,6 +378,9 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { {querySubmenuItem ? ( { + e.stopPropagation(); + }} rows={1} ref={queryInputRef} placeholder={querySubmenuItem.description} @@ -436,7 +439,10 @@ const MentionList = forwardRef((props: MentionListProps, ref) => { ref={(el) => (itemRefs.current[index] = el)} className={`item cursor-pointer ${isSelected ? "is-selected" : ""}`} key={index} - onClick={() => selectItem(index)} + onClick={(e) => { + e.stopPropagation(); + selectItem(index); + }} onMouseEnter={() => setSelectedIndex(index)} data-testid="context-provider-dropdown-item" > From 23043e06704c07b59be63df5724f53df288cf02d Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 19 Feb 2025 17:41:39 -0800 Subject: [PATCH 17/25] reinstate copy buffer --- extensions/vscode/src/commands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index d99bbd5ae..e745e2a30 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -1056,7 +1056,7 @@ export function registerAllCommands( core: Core, editDecorationManager: EditDecorationManager, ) { - // registerCopyBufferSpy(context, core); + registerCopyBufferSpy(context, core); for (const [command, callback] of Object.entries( getCommandsMap( From 68471dedc74960809fb33dc02681678f8cd16766 Mon Sep 17 00:00:00 2001 From: Adam Shedivy Date: Thu, 20 Feb 2025 11:51:22 -0600 Subject: [PATCH 18/25] Add conditional check before sending refreshSubmenuItems message --- core/core.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/core.ts b/core/core.ts index 955758aaf..b7d968f11 100644 --- a/core/core.ts +++ b/core/core.ts @@ -140,9 +140,12 @@ export class Core { }); // update additional submenu context providers registered via VSCode API - this.messenger.send("refreshSubmenuItems", { - providers: this.configHandler.getAdditionalSubmenuContextProviders() - }); + const additionalProviders = this.configHandler.getAdditionalSubmenuContextProviders(); + if (additionalProviders.length > 0) { + this.messenger.send("refreshSubmenuItems", { + providers: additionalProviders, + }); + } }); this.configHandler.onDidChangeAvailableProfiles((profiles) => From 3abe7c33c049897c19c715f57470aeeff305d9d9 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 20 Feb 2025 12:11:12 -0800 Subject: [PATCH 19/25] add required action override --- .../autocomplete/CancelAutocompleteAction.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt index 93eb805b3..8b5159d4d 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/autocomplete/CancelAutocompleteAction.kt @@ -1,5 +1,6 @@ package com.github.continuedev.continueintellijextension.autocomplete +import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -27,4 +28,8 @@ class CancelAutocompleteAction : AnAction() { val editor: Editor? = e.getData(CommonDataKeys.EDITOR) return project != null && editor != null && editor.contentComponent.hasFocus() } + + override fun getActionUpdateThread(): ActionUpdateThread { + return ActionUpdateThread.BGT + } } From a93a30c937b0f1754b33e1eecb52552f39c208e6 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 20 Feb 2025 13:51:01 -0800 Subject: [PATCH 20/25] increase timeout to 1500 ms --- .../continueintellijextension/editor/InlineEditAction.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt index 8fcaf590a..faaf7d058 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/InlineEditAction.kt @@ -137,7 +137,10 @@ fun openInlineEdit(project: Project?, editor: Editor) { modelTitles.addAll(models.map { it["title"] as String }) } - val maxWaitTime = 200 + // This is a hacky way to not complicate getting model titles with coroutines + // 1500 feels like way upper limit of "would be weird if panel showed up after that long" + // And should always allow enough time to load config + val maxWaitTime = 1500 val startTime = System.currentTimeMillis() while (modelTitles.isEmpty() && System.currentTimeMillis() - startTime < maxWaitTime) { Thread.sleep(20) From 3acbaa1d4e618beb7a3232be4ea0bac009c86d07 Mon Sep 17 00:00:00 2001 From: Patrick Erichsen Date: Thu, 20 Feb 2025 14:33:30 -0800 Subject: [PATCH 21/25] chore: remove unnecessary async declaration --- packages/config-yaml/package.json | 2 +- packages/config-yaml/src/interfaces/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/config-yaml/package.json b/packages/config-yaml/package.json index 44f05cc9a..b6de2b8a1 100644 --- a/packages/config-yaml/package.json +++ b/packages/config-yaml/package.json @@ -1,6 +1,6 @@ { "name": "@continuedev/config-yaml", - "version": "1.0.34", + "version": "1.0.35", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/config-yaml/src/interfaces/index.ts b/packages/config-yaml/src/interfaces/index.ts index 264a2d376..d57dbf587 100644 --- a/packages/config-yaml/src/interfaces/index.ts +++ b/packages/config-yaml/src/interfaces/index.ts @@ -76,7 +76,7 @@ export function getLocationsToLook( return locationsToLook; } -export async function listAvailableSecrets( +export function listAvailableSecrets( userSecretNames: string[], orgSecretNames: string[], assistantSecretNames: string[], @@ -84,7 +84,7 @@ export async function listAvailableSecrets( assistantSlug: PackageSlug, blockSlug: PackageSlug | undefined, currentUserSlug: string, -): Promise { +): SecretLocation[] { // Create a set of all secret names const allSecretNames = new Set([ ...userSecretNames, From 6a487e25ad59abdb48b7b28f4fa2feea21f507fe Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 20 Feb 2025 14:57:48 -0800 Subject: [PATCH 22/25] persist edit vs chat mode --- gui/src/redux/slices/sessionSlice.ts | 1 - gui/src/redux/store.ts | 15 ++++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gui/src/redux/slices/sessionSlice.ts b/gui/src/redux/slices/sessionSlice.ts index dd8f0b5bb..c70de4035 100644 --- a/gui/src/redux/slices/sessionSlice.ts +++ b/gui/src/redux/slices/sessionSlice.ts @@ -53,7 +53,6 @@ type SessionState = { streamAborter: AbortController; codeToEdit: CodeToEdit[]; curCheckpointIndex: number; - currentMainEditorContent?: JSONContent; mainEditorContentTrigger?: JSONContent | undefined; symbols: FileSymbolMap; mode: MessageModes; diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index 8cfb8f937..e2b222340 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -33,9 +33,22 @@ const rootReducer = combineReducers({ const saveSubsetFilters = [ createFilter("session", [ "history", - "sessionId", "selectedOrganizationId", "selectedProfile", + "id", + "lastSessionId", + "title", + "mode", + + // TODO consider removing persisted profiles/orgs + "availableProfiles", + "organizations", + + // higher risk to persist + // codeToEdit + // codeBlockApplyStates + // symbols + // curCheckpointIndex ]), // Don't persist any of the edit state for now createFilter("editModeState", []), From 0ffb30e35c20ba7d06a4bf316878f6041cafffc4 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 20 Feb 2025 15:08:27 -0800 Subject: [PATCH 23/25] fix tool inclusion logic for edit --- gui/src/components/mainInput/ContinueInputBox.tsx | 1 - gui/src/components/mainInput/InputToolbar.tsx | 8 ++------ gui/src/redux/thunks/streamNormalInput.ts | 5 ++++- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gui/src/components/mainInput/ContinueInputBox.tsx b/gui/src/components/mainInput/ContinueInputBox.tsx index bdfe15ba6..69264eb35 100644 --- a/gui/src/components/mainInput/ContinueInputBox.tsx +++ b/gui/src/components/mainInput/ContinueInputBox.tsx @@ -109,7 +109,6 @@ function ContinueInputBox(props: ContinueInputBoxProps) { hideImageUpload: false, hideUseCodebase: true, hideSelectModel: false, - hideTools: true, enterText: editModeState.editStatus === "accepting" ? "Retry" : "Edit", } : {}; diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index a6b92ab90..99644dc9d 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -67,7 +67,6 @@ export interface ToolbarOptions { hideAddContext?: boolean; enterText?: string; hideSelectModel?: boolean; - hideTools?: boolean; } interface InputToolbarProps { @@ -91,10 +90,7 @@ function InputToolbar(props: InputToolbarProps) { const hasCodeToEdit = useAppSelector(selectHasCodeToEdit); const isEditModeAndNoCodeToEdit = isInEditMode && !hasCodeToEdit; const isEnterDisabled = props.disabled || isEditModeAndNoCodeToEdit; - const toolsSupported = - defaultModel && - modelSupportsTools(defaultModel) && - !props.toolbarOptions?.hideTools; + const toolsSupported = defaultModel && modelSupportsTools(defaultModel); const supportsImages = defaultModel && @@ -158,7 +154,7 @@ function InputToolbar(props: InputToolbarProps) { )} - + {!isInEditMode && }
diff --git a/gui/src/redux/thunks/streamNormalInput.ts b/gui/src/redux/thunks/streamNormalInput.ts index 1bd82a030..fe20fa550 100644 --- a/gui/src/redux/thunks/streamNormalInput.ts +++ b/gui/src/redux/thunks/streamNormalInput.ts @@ -27,7 +27,10 @@ export const streamNormalInput = createAsyncThunk< throw new Error("Default model not defined"); } - const includeTools = useTools && modelSupportsTools(defaultModel); + const includeTools = + useTools && + modelSupportsTools(defaultModel) && + state.session.mode === "chat"; // Send request const gen = extra.ideMessenger.llmStreamChat( From 4959f24473f8428bda33088fbe227f5bca11c940 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 20 Feb 2025 15:11:58 -0800 Subject: [PATCH 24/25] persist code to edit --- gui/src/redux/store.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gui/src/redux/store.ts b/gui/src/redux/store.ts index e2b222340..f137cbe7b 100644 --- a/gui/src/redux/store.ts +++ b/gui/src/redux/store.ts @@ -38,14 +38,16 @@ const saveSubsetFilters = [ "id", "lastSessionId", "title", + + // Persist edit mode in case closes in middle "mode", + "codeToEdit", // TODO consider removing persisted profiles/orgs "availableProfiles", "organizations", // higher risk to persist - // codeToEdit // codeBlockApplyStates // symbols // curCheckpointIndex From b5ab8618c1b035a6faf21dd15233970a1af6936e Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Thu, 20 Feb 2025 15:15:34 -0800 Subject: [PATCH 25/25] show disabled tools in edit mode --- gui/src/components/mainInput/InputToolbar.tsx | 2 +- .../InputToolbar/ToggleToolsButton.tsx | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/gui/src/components/mainInput/InputToolbar.tsx b/gui/src/components/mainInput/InputToolbar.tsx index 99644dc9d..49c40e65d 100644 --- a/gui/src/components/mainInput/InputToolbar.tsx +++ b/gui/src/components/mainInput/InputToolbar.tsx @@ -154,7 +154,7 @@ function InputToolbar(props: InputToolbarProps) { )} - {!isInEditMode && } + diff --git a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx index 3265b2778..cffc967f0 100644 --- a/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx +++ b/gui/src/components/mainInput/InputToolbar/ToggleToolsButton.tsx @@ -14,6 +14,7 @@ import InfoHover from "../../InfoHover"; import HoverItem from "./HoverItem"; import PopoverTransition from "./PopoverTransition"; import ToolDropdownItem from "./ToolDropdownItem"; +import { selectIsInEditMode } from "../../../redux/slices/sessionSlice"; interface ToolDropdownProps { disabled: boolean; @@ -28,6 +29,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { const useTools = useAppSelector((state) => state.ui.useTools); const availableTools = useAppSelector((state) => state.config.config.tools); const [showAbove, setShowAbove] = useState(false); + const isInEditMode = useAppSelector(selectIsInEditMode); const ToolsIcon = useTools ? WrenchScrewdriverIconSolid @@ -48,33 +50,37 @@ export default function ToolDropdown(props: ToolDropdownProps) { } }, [isDropdownOpen]); + const isDisabled = props.disabled || isInEditMode; + return ( - !props.disabled && dispatch(toggleUseTools())}> + !isDisabled && dispatch(toggleUseTools())}>
!props.disabled && setIsHovered(true)} - onMouseLeave={() => !props.disabled && setIsHovered(false)} + onMouseEnter={() => !isDisabled && setIsHovered(true)} + onMouseLeave={() => !isDisabled && setIsHovered(false)} /> - {props.disabled && ( + {isDisabled && ( - This model does not support tool use + {isInEditMode + ? "Tool use not supported in edit mode" + : "This model does not support tool use"} )} - {!useTools && !props.disabled && ( + {!useTools && !isDisabled && ( Enable tool usage )} - {useTools && !props.disabled && ( + {useTools && !isDisabled && ( <> Tools @@ -84,7 +90,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { onChange={() => {}} as="div" onClick={(e) => e.stopPropagation()} - disabled={props.disabled} + disabled={isDisabled} > {({ open }) => ( <> @@ -95,7 +101,7 @@ export default function ToolDropdown(props: ToolDropdownProps) { setDropdownOpen(!isDropdownOpen); }} className="text-lightgray flex cursor-pointer items-center border-none bg-transparent px-0 outline-none" - aria-disabled={props.disabled} + aria-disabled={isDisabled} >