From 8a4118db1dc2186cbc4ab2ab678033e466962405 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 21 Nov 2024 18:23:17 -0800 Subject: [PATCH 01/10] improve styling of add to file btn --- gui/src/pages/Edit/AddFileButton.tsx | 10 ++++------ gui/src/pages/Edit/CodeToEdit.tsx | 2 +- gui/src/pages/Edit/CodeToEditListItem.tsx | 5 +++-- manual-testing-sandbox/testCalculator.js | 0 4 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 manual-testing-sandbox/testCalculator.js diff --git a/gui/src/pages/Edit/AddFileButton.tsx b/gui/src/pages/Edit/AddFileButton.tsx index 2f9e0f0dd..7fd7e7768 100644 --- a/gui/src/pages/Edit/AddFileButton.tsx +++ b/gui/src/pages/Edit/AddFileButton.tsx @@ -29,7 +29,7 @@ export default function AddFileButton() {
-
+
- + Add all open files diff --git a/gui/src/pages/Edit/CodeToEdit.tsx b/gui/src/pages/Edit/CodeToEdit.tsx index 26cb145d4..9de5847c3 100644 --- a/gui/src/pages/Edit/CodeToEdit.tsx +++ b/gui/src/pages/Edit/CodeToEdit.tsx @@ -57,7 +57,7 @@ export default function WorkingSet() {
{hasCodeToEdit && ( -
    +
      {codeToEditItems}
    )} diff --git a/gui/src/pages/Edit/CodeToEditListItem.tsx b/gui/src/pages/Edit/CodeToEditListItem.tsx index 8d84ef34b..c7cb46ff5 100644 --- a/gui/src/pages/Edit/CodeToEditListItem.tsx +++ b/gui/src/pages/Edit/CodeToEditListItem.tsx @@ -53,7 +53,7 @@ export default function CodeToEditListItem({ return (
  • setShowCodeSnippet((showCodeSnippet) => !showCodeSnippet)} >
    -
    +
    { e.stopPropagation(); @@ -98,6 +98,7 @@ export default function CodeToEditListItem({ />
    + {showCodeSnippet && (
    diff --git a/manual-testing-sandbox/testCalculator.js b/manual-testing-sandbox/testCalculator.js deleted file mode 100644 index e69de29bb..000000000 From 5a8237407748df0ea7397201cf74036915411010 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 21 Nov 2024 18:53:33 -0800 Subject: [PATCH 02/10] add keyboard shortcuts to accept/reject --- extensions/vscode/src/commands.ts | 10 ++++++++-- .../StepContainer/AcceptRejectAllButtons.tsx | 5 +++-- gui/src/pages/Edit/CodeToEdit.tsx | 18 +++++++++--------- gui/src/pages/Edit/CodeToEditListItem.tsx | 5 ++++- .../{test.java => Calculator.java} | 1 + 5 files changed, 25 insertions(+), 14 deletions(-) rename manual-testing-sandbox/{test.java => Calculator.java} (99%) diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index 43115ae93..f41a308ae 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -218,10 +218,16 @@ async function processDiff( } else if (fullPath) { fullPath = getFullyQualifiedPath(ide, fullPath); } else { - console.warn(`Unable to resolve filepath: ${newFilepath}`); + const curFile = await ide.getCurrentFile(); + fullPath = curFile?.path; } - if (!fullPath) return; + if (!fullPath) { + console.warn( + `Unable to resolve filepath while attempting to resolve diff: ${newFilepath}`, + ); + return; + } await ide.openFile(fullPath); diff --git a/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx b/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx index d8a17ec8a..632468a65 100644 --- a/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx +++ b/gui/src/components/StepContainer/AcceptRejectAllButtons.tsx @@ -2,6 +2,7 @@ import { useContext } from "react"; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline"; import { ApplyState } from "core"; +import { getMetaKeyLabel } from "../../util"; export interface AcceptRejectAllButtonsProps { pendingApplyStates: ApplyState[]; @@ -37,7 +38,7 @@ export default function AcceptRejectAllButtons({ > {hasSinglePendingApplyStates ? ( - Reject + Reject ({getMetaKeyLabel()}⇧⌫) ) : ( <> Reject @@ -52,7 +53,7 @@ export default function AcceptRejectAllButtons({ > {hasSinglePendingApplyStates ? ( - Accept + Accept ({getMetaKeyLabel()}⇧⏎) ) : ( <> Accept diff --git a/gui/src/pages/Edit/CodeToEdit.tsx b/gui/src/pages/Edit/CodeToEdit.tsx index 9de5847c3..4197488fc 100644 --- a/gui/src/pages/Edit/CodeToEdit.tsx +++ b/gui/src/pages/Edit/CodeToEdit.tsx @@ -11,16 +11,16 @@ import AddFileButton from "./AddFileButton"; export default function WorkingSet() { const dispatch = useDispatch(); const ideMessenger = useContext(IdeMessengerContext); - const editModeState = useSelector((state: RootState) => state.editModeState); - - const hasCodeToEdit = editModeState.codeToEdit.length > 0; + const codeToEdit = useSelector( + (state: RootState) => state.editModeState.codeToEdit, + ); const title = - editModeState.codeToEdit.length === 0 + codeToEdit.length === 0 ? "Code to edit" - : editModeState.codeToEdit.length === 1 + : codeToEdit.length === 1 ? "Code to edit (1 item)" - : `Code to edit (${editModeState.codeToEdit.length} items)`; + : `Code to edit (${codeToEdit.length} items)`; function onDelete(rif: RangeInFileWithContents) { dispatch(removeCodeToEdit(rif)); @@ -38,7 +38,7 @@ export default function WorkingSet() { } } - const codeToEditItems = [...editModeState.codeToEdit] + const codeToEditItems = [...codeToEdit] .reverse() .map((code, i) => ( -
    +
    {title}
    - {hasCodeToEdit && ( + {codeToEdit.length > 0 && (
      {codeToEditItems}
    diff --git a/gui/src/pages/Edit/CodeToEditListItem.tsx b/gui/src/pages/Edit/CodeToEditListItem.tsx index c7cb46ff5..e672b8f89 100644 --- a/gui/src/pages/Edit/CodeToEditListItem.tsx +++ b/gui/src/pages/Edit/CodeToEditListItem.tsx @@ -40,7 +40,10 @@ export default function CodeToEditListItem({ let title = filepath; if ("range" in code) { - title += ` (${code.range.start.line + 1} - ${code.range.end.line + 1})`; + const start = code.range.start.line + 1; + const end = code.range.end.line + 1; + title += + start === end ? ` - Inserting at line ${start}` : ` (${start} - ${end})`; } const source = diff --git a/manual-testing-sandbox/test.java b/manual-testing-sandbox/Calculator.java similarity index 99% rename from manual-testing-sandbox/test.java rename to manual-testing-sandbox/Calculator.java index 0f22df25a..b9b9147e9 100644 --- a/manual-testing-sandbox/test.java +++ b/manual-testing-sandbox/Calculator.java @@ -11,6 +11,7 @@ public class Calculator { return this; } + public double getResult() { return result; } From ef26b7c80eb0cc503017df8b9abd634f868a9b89 Mon Sep 17 00:00:00 2001 From: liuk Date: Fri, 22 Nov 2024 18:25:44 +0800 Subject: [PATCH 03/10] fix: Clipboard is not available in chat window --- gui/src/components/mainInput/TipTapEditor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/TipTapEditor.tsx b/gui/src/components/mainInput/TipTapEditor.tsx index bde052274..7737e5f25 100644 --- a/gui/src/components/mainInput/TipTapEditor.tsx +++ b/gui/src/components/mainInput/TipTapEditor.tsx @@ -598,7 +598,7 @@ function TipTapEditor(props: TipTapEditorProps) { if (isOSREnabled) { handleJetBrainsOSRMetaKeyIssues(e, editor); - } else { + } else if (!isJetBrains()){ await handleVSCMetaKeyIssues(e, editor); } }; From b4000e1e8e301c0c751c1b4f73158069a4a4e4d6 Mon Sep 17 00:00:00 2001 From: liuk Date: Fri, 22 Nov 2024 20:46:43 +0800 Subject: [PATCH 04/10] refactor: Improve the diff block logic for inline chat --- .../editor/EditorComponentInlaysManager.kt | 4 ++-- .../continueintellijextension/editor/VerticalDiffBlock.kt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt index 7de018bb2..b4f099d2d 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/editor/EditorComponentInlaysManager.kt @@ -51,7 +51,7 @@ class EditorComponentInlaysManager(val editor: EditorImpl, private val onlyOneIn } val wrappedComponent = ComponentWrapper(component) - val offset = editor.document.getLineEndOffset(lineIndex) + val offset = editor.document.getLineStartOffset(lineIndex) return EditorEmbeddedComponentManager.getInstance() .addComponent( @@ -59,7 +59,7 @@ class EditorComponentInlaysManager(val editor: EditorImpl, private val onlyOneIn EditorEmbeddedComponentManager.Properties( EditorEmbeddedComponentManager.ResizePolicy.none(), null, - true, + !editor.inlayModel.getBlockElementsInRange(offset,offset).isEmpty(), showAbove, 0, offset 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 a84bf7f9b..64f1d1bb7 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 @@ -59,11 +59,12 @@ class VerticalDiffBlock( fun deleteLineAt(line: Int) { val startOffset = editor.document.getLineStartOffset(line) - val endOffset = editor.document.getLineEndOffset(line) + 1 + val endOffset = min(editor.document.getLineEndOffset(line) + 1, editor.document.textLength) val deletedText = editor.document.getText(TextRange(startOffset, endOffset)) deletedLines.add(deletedText.trimEnd()) + // Unable to ensure that text length has not changed, so we need to get it again editor.document.deleteString(startOffset, min(endOffset, editor.document.textLength)) } From 0b53b2a85569b77ead3462bccac50d2b25c0aa2c Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 22 Nov 2024 09:54:26 -0800 Subject: [PATCH 05/10] bump package.json version --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index ef2d12c82..9d4216ac3 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.232", + "version": "0.8.58", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From f123e379ebd50434c33cfbc56ae15c3dc44fc8db Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 22 Nov 2024 09:58:27 -0800 Subject: [PATCH 06/10] update changelog --- .changes/extensions/vscode/0.8.58.md | 25 +++++++++++++++++++ .../unreleased/Added-20241108-113942.yaml | 4 --- .../unreleased/Added-20241108-114100.yaml | 4 --- .../unreleased/Added-20241108-114423.yaml | 4 --- .../unreleased/Added-20241108-114437.yaml | 4 --- .../unreleased/Added-20241108-114450.yaml | 4 --- .../unreleased/Added-20241108-114612.yaml | 4 --- .../unreleased/Added-20241108-114622.yaml | 4 --- .../unreleased/Added-20241108-114649.yaml | 4 --- .../unreleased/Added-20241108-114753.yaml | 4 --- .../unreleased/Added-20241108-114813.yaml | 4 --- .../unreleased/Added-20241113-165958.yaml | 4 --- .../unreleased/Added-20241113-170006.yaml | 4 --- .../unreleased/Changed-20241108-114549.yaml | 4 --- .../unreleased/Changed-20241108-114850.yaml | 4 --- .../unreleased/Fixed-20241108-114905.yaml | 4 --- extensions/vscode/CHANGELOG.md | 8 +++++- 17 files changed, 32 insertions(+), 61 deletions(-) create mode 100644 .changes/extensions/vscode/0.8.58.md delete mode 100644 .changes/unreleased/Added-20241108-113942.yaml delete mode 100644 .changes/unreleased/Added-20241108-114100.yaml delete mode 100644 .changes/unreleased/Added-20241108-114423.yaml delete mode 100644 .changes/unreleased/Added-20241108-114437.yaml delete mode 100644 .changes/unreleased/Added-20241108-114450.yaml delete mode 100644 .changes/unreleased/Added-20241108-114612.yaml delete mode 100644 .changes/unreleased/Added-20241108-114622.yaml delete mode 100644 .changes/unreleased/Added-20241108-114649.yaml delete mode 100644 .changes/unreleased/Added-20241108-114753.yaml delete mode 100644 .changes/unreleased/Added-20241108-114813.yaml delete mode 100644 .changes/unreleased/Added-20241113-165958.yaml delete mode 100644 .changes/unreleased/Added-20241113-170006.yaml delete mode 100644 .changes/unreleased/Changed-20241108-114549.yaml delete mode 100644 .changes/unreleased/Changed-20241108-114850.yaml delete mode 100644 .changes/unreleased/Fixed-20241108-114905.yaml diff --git a/.changes/extensions/vscode/0.8.58.md b/.changes/extensions/vscode/0.8.58.md new file mode 100644 index 000000000..98c845b97 --- /dev/null +++ b/.changes/extensions/vscode/0.8.58.md @@ -0,0 +1,25 @@ +## 0.8.58 - 2024-11-22 +### Added +* OpenAI predicted outputs support +* Improve codebase retrieval with BM25 +* Support for Grok from xAI +* Chat enhancements including sticking input to bottom +* New UI for cmd+I in sidebar +* Support for Nebius LLM provider +* Support for Ask Sage LLM provider +* Improved reference for config.json +* New @web context provider +* Updates for llama3.2 +* .continuerules file to set system prompt +* .prompt files v2 +* Dedicated UI for docs indexing +* Clickable code symbols in chat +* Use clipboard content as autocomplete context +### Changed +* Improved @docs crawler +* Many improvements to make autocomplete more eager +* Near complete type definition retrieval for TypeScript autocomplete +* Remove footer from chat sidebar +### Fixed +* Brought back the Apply button for all code blocks +* Automatically update codebase index on removed files diff --git a/.changes/unreleased/Added-20241108-113942.yaml b/.changes/unreleased/Added-20241108-113942.yaml deleted file mode 100644 index 987643345..000000000 --- a/.changes/unreleased/Added-20241108-113942.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: OpenAI predicted outputs support -time: 2024-11-08T11:39:42.277047-08:00 diff --git a/.changes/unreleased/Added-20241108-114100.yaml b/.changes/unreleased/Added-20241108-114100.yaml deleted file mode 100644 index af7cb5444..000000000 --- a/.changes/unreleased/Added-20241108-114100.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Improve codebase retrieval with BM25 -time: 2024-11-08T11:41:00.002716-08:00 diff --git a/.changes/unreleased/Added-20241108-114423.yaml b/.changes/unreleased/Added-20241108-114423.yaml deleted file mode 100644 index fc3a6eaf7..000000000 --- a/.changes/unreleased/Added-20241108-114423.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Support for Grok from xAI -time: 2024-11-08T11:44:23.761084-08:00 diff --git a/.changes/unreleased/Added-20241108-114437.yaml b/.changes/unreleased/Added-20241108-114437.yaml deleted file mode 100644 index fab18b954..000000000 --- a/.changes/unreleased/Added-20241108-114437.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Chat enhancements including sticking input to bottom -time: 2024-11-08T11:44:37.408176-08:00 diff --git a/.changes/unreleased/Added-20241108-114450.yaml b/.changes/unreleased/Added-20241108-114450.yaml deleted file mode 100644 index 14644f3e9..000000000 --- a/.changes/unreleased/Added-20241108-114450.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: New UI for cmd+I in sidebar -time: 2024-11-08T11:44:50.682952-08:00 diff --git a/.changes/unreleased/Added-20241108-114612.yaml b/.changes/unreleased/Added-20241108-114612.yaml deleted file mode 100644 index 68d8b27d1..000000000 --- a/.changes/unreleased/Added-20241108-114612.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Support for Nebius LLM provider -time: 2024-11-08T11:46:12.94828-08:00 diff --git a/.changes/unreleased/Added-20241108-114622.yaml b/.changes/unreleased/Added-20241108-114622.yaml deleted file mode 100644 index e91ddb398..000000000 --- a/.changes/unreleased/Added-20241108-114622.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Support for Ask Sage LLM provider -time: 2024-11-08T11:46:22.626907-08:00 diff --git a/.changes/unreleased/Added-20241108-114649.yaml b/.changes/unreleased/Added-20241108-114649.yaml deleted file mode 100644 index 0e7a0c9d0..000000000 --- a/.changes/unreleased/Added-20241108-114649.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Improved reference for config.json -time: 2024-11-08T11:46:49.648545-08:00 diff --git a/.changes/unreleased/Added-20241108-114753.yaml b/.changes/unreleased/Added-20241108-114753.yaml deleted file mode 100644 index 8cb7f1805..000000000 --- a/.changes/unreleased/Added-20241108-114753.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: New @web context provider -time: 2024-11-08T11:47:53.447346-08:00 diff --git a/.changes/unreleased/Added-20241108-114813.yaml b/.changes/unreleased/Added-20241108-114813.yaml deleted file mode 100644 index cd5ba1067..000000000 --- a/.changes/unreleased/Added-20241108-114813.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: Updates for llama3.2 -time: 2024-11-08T11:48:13.830692-08:00 diff --git a/.changes/unreleased/Added-20241113-165958.yaml b/.changes/unreleased/Added-20241113-165958.yaml deleted file mode 100644 index 95aaa7c70..000000000 --- a/.changes/unreleased/Added-20241113-165958.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: .continuerules file to set system prompt -time: 2024-11-13T16:59:58.544875-08:00 diff --git a/.changes/unreleased/Added-20241113-170006.yaml b/.changes/unreleased/Added-20241113-170006.yaml deleted file mode 100644 index bc254f8d9..000000000 --- a/.changes/unreleased/Added-20241113-170006.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Added -body: .prompt files v2 -time: 2024-11-13T17:00:06.855468-08:00 diff --git a/.changes/unreleased/Changed-20241108-114549.yaml b/.changes/unreleased/Changed-20241108-114549.yaml deleted file mode 100644 index d340736b6..000000000 --- a/.changes/unreleased/Changed-20241108-114549.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Changed -body: Improved @docs crawler -time: 2024-11-08T11:45:49.381554-08:00 diff --git a/.changes/unreleased/Changed-20241108-114850.yaml b/.changes/unreleased/Changed-20241108-114850.yaml deleted file mode 100644 index ab6c2a037..000000000 --- a/.changes/unreleased/Changed-20241108-114850.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Changed -body: Many improvements to make autocomplete more eager -time: 2024-11-08T11:48:50.486502-08:00 diff --git a/.changes/unreleased/Fixed-20241108-114905.yaml b/.changes/unreleased/Fixed-20241108-114905.yaml deleted file mode 100644 index eb590eeb4..000000000 --- a/.changes/unreleased/Fixed-20241108-114905.yaml +++ /dev/null @@ -1,4 +0,0 @@ -project: extensions/vscode -kind: Fixed -body: Brought back the Apply button for all code blocks -time: 2024-11-08T11:49:05.021499-08:00 diff --git a/extensions/vscode/CHANGELOG.md b/extensions/vscode/CHANGELOG.md index 8dac5cd8c..ccbdc326d 100644 --- a/extensions/vscode/CHANGELOG.md +++ b/extensions/vscode/CHANGELOG.md @@ -5,7 +5,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html), and is generated by [Changie](https://github.com/miniscruff/changie). -Pre-release Changes +## 0.8.58 - 2024-11-22 ### Added * OpenAI predicted outputs support * Improve codebase retrieval with BM25 @@ -19,11 +19,17 @@ Pre-release Changes * Updates for llama3.2 * .continuerules file to set system prompt * .prompt files v2 +* Dedicated UI for docs indexing +* Clickable code symbols in chat +* Use clipboard content as autocomplete context ### Changed * Improved @docs crawler * Many improvements to make autocomplete more eager +* Near complete type definition retrieval for TypeScript autocomplete +* Remove footer from chat sidebar ### Fixed * Brought back the Apply button for all code blocks +* Automatically update codebase index on removed files ## 0.8.56 - 2024-11-08 ### Added From 6f5ddad3c336af8a9ea90af33e71c21f32e31496 Mon Sep 17 00:00:00 2001 From: Ty Dunn Date: Fri, 22 Nov 2024 11:15:38 -0800 Subject: [PATCH 07/10] Update Together.ai recommendation to Qwen2.5 Coder 32B Instruct --- docs/docs/customize/model-providers/more/together.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/customize/model-providers/more/together.md b/docs/docs/customize/model-providers/more/together.md index b02c83172..e5ed9abd0 100644 --- a/docs/docs/customize/model-providers/more/together.md +++ b/docs/docs/customize/model-providers/more/together.md @@ -1,14 +1,14 @@ # Together -The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/models-inference). Change `~/.continue/config.json` to look like this: +The Together API is a cloud platform for running large AI models. You can sign up [here](https://api.together.xyz/signup), copy your API key on the initial welcome screen, and then hit the play button on any model from the [Together Models list](https://docs.together.ai/docs/serverless-models). Change `~/.continue/config.json` to look like this: ```json title="config.json" { "models": [ { - "title": "Together CodeLlama", + "title": "Together Qwen2.5 Coder", "provider": "together", - "model": "codellama-13b", + "model": "Qwen/Qwen2.5-Coder-32B-Instruct", "apiKey": "YOUR_API_KEY" } ] From ba83fd5d6152a012c0093154591c86692693f50b Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 22 Nov 2024 14:30:37 -0800 Subject: [PATCH 08/10] hotfix for over-eager, repetitive completions --- .../StreamTransformPipeline.ts | 4 +- .../filtering/streamTransforms/lineStream.ts | 53 ++++--- ... => stopNCharsAfterClosingBracket.test.ts} | 137 ++++++++---------- 3 files changed, 92 insertions(+), 102 deletions(-) rename core/autocomplete/filtering/streamTransforms/{noDoubleNewlineAfterClosingBracket.test.ts => stopNCharsAfterClosingBracket.test.ts} (57%) diff --git a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts index 6097ff797..f1fb49300 100644 --- a/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts +++ b/core/autocomplete/filtering/streamTransforms/StreamTransformPipeline.ts @@ -6,12 +6,12 @@ import { stopAtStopTokens } from "./charStream"; import { avoidEmptyComments, avoidPathLine, - noDoubleNewlineAfterClosingBracket, showWhateverWeHaveAtXMs, skipPrefixes, stopAtLines, stopAtRepeatingLines, stopAtSimilarLine, + stopNCharsAfterClosingBracket, streamWithNewLines, } from "./lineStream"; @@ -48,7 +48,7 @@ export class StreamTransformPipeline { ); lineGenerator = avoidPathLine(lineGenerator, helper.lang.singleLineComment); lineGenerator = skipPrefixes(lineGenerator); - lineGenerator = noDoubleNewlineAfterClosingBracket(lineGenerator); + lineGenerator = stopNCharsAfterClosingBracket(lineGenerator); for (const lineFilter of helper.lang.lineFilters ?? []) { lineGenerator = lineFilter({ lines: lineGenerator, fullStop }); diff --git a/core/autocomplete/filtering/streamTransforms/lineStream.ts b/core/autocomplete/filtering/streamTransforms/lineStream.ts index 160fc9d85..e1ca83492 100644 --- a/core/autocomplete/filtering/streamTransforms/lineStream.ts +++ b/core/autocomplete/filtering/streamTransforms/lineStream.ts @@ -547,32 +547,21 @@ export async function* showWhateverWeHaveAtXMs( } } -export async function* noDoubleNewlineAfterClosingBracket( +export async function* stopNCharsAfterClosingBracket( lines: LineStream, + n: number = 20, ): LineStream { const bracketTypeCounts = new Map(); + let charsToStopAt: number | null = null; for await (const line of lines) { - if (line.trim() === "") { - // Double newline detected - // Check if any bracket counts are negative - let hasNegativeCount = false; - for (const count of bracketTypeCounts.values()) { - if (count < 0) { - hasNegativeCount = true; - break; - } - } - if (hasNegativeCount) { - // Stop the generator if we've closed brackets we didn't open - return; - } - } + let outputLine = ""; + let i = 0; - yield line; + while (i < line.length) { + const char = line[i]; - // Update bracket counts - for (const char of line) { + // Update bracket counts if (BRACKETS[char]) { // It's an opening bracket const count = bracketTypeCounts.get(char) || 0; @@ -581,8 +570,32 @@ export async function* noDoubleNewlineAfterClosingBracket( // It's a closing bracket const openingBracket = BRACKETS_REVERSE[char]; const count = bracketTypeCounts.get(openingBracket) || 0; - bracketTypeCounts.set(openingBracket, count - 1); + const newCount = count - 1; + bracketTypeCounts.set(openingBracket, newCount); + + if (newCount < 0 && charsToStopAt === null) { + // Unmatched closing bracket detected + charsToStopAt = n; + } } + + // Add the character to the output line + outputLine += char; + + // If we've started counting down, decrement the remaining characters + if (charsToStopAt !== null) { + charsToStopAt -= 1; + if (charsToStopAt <= 0) { + // Yield the output line up to this point and stop the generator + yield outputLine; + return; + } + } + + i += 1; } + + // Yield whatever we've accumulated for this line + yield outputLine; } } diff --git a/core/autocomplete/filtering/streamTransforms/noDoubleNewlineAfterClosingBracket.test.ts b/core/autocomplete/filtering/streamTransforms/stopNCharsAfterClosingBracket.test.ts similarity index 57% rename from core/autocomplete/filtering/streamTransforms/noDoubleNewlineAfterClosingBracket.test.ts rename to core/autocomplete/filtering/streamTransforms/stopNCharsAfterClosingBracket.test.ts index a25b5d4bf..e5e003f80 100644 --- a/core/autocomplete/filtering/streamTransforms/noDoubleNewlineAfterClosingBracket.test.ts +++ b/core/autocomplete/filtering/streamTransforms/stopNCharsAfterClosingBracket.test.ts @@ -1,4 +1,4 @@ -import { noDoubleNewlineAfterClosingBracket } from "./lineStream"; +import { stopNCharsAfterClosingBracket } from "./lineStream"; describe("noDoubleNewlineAfterClosingBracket", () => { // Helper function to convert an array to an async generator @@ -17,7 +17,7 @@ describe("noDoubleNewlineAfterClosingBracket", () => { return result; } - test("should yield all lines when no double newline and no unmatched brackets", async () => { + test("should yield all lines when no unmatched brackets", async () => { const inputLines = [ "function test() {", ' console.log("Hello World");', @@ -25,50 +25,84 @@ describe("noDoubleNewlineAfterClosingBracket", () => { ]; const lines = arrayToAsyncGenerator(inputLines); const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), + stopNCharsAfterClosingBracket(lines), ); expect(outputLines).toEqual(inputLines); }); - test("should yield all lines when double newline but brackets are matched", async () => { + test("should yield all lines when >20 chars after brackets but brackets are matched", async () => { const inputLines = [ "function test() {", ' console.log("Hello World");', "}", - "", - "", - "// End of function", + "// End of function and start of something else", ]; const lines = arrayToAsyncGenerator(inputLines); const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), + stopNCharsAfterClosingBracket(lines), ); expect(outputLines).toEqual(inputLines); }); - test("should stop yielding after double newline when unmatched closing bracket is found before double newline", async () => { + test("should stop yielding after 20 chars when unmatched closing bracket is found", async () => { const inputLines = [ // "function test() {", ' console.log("Hello World");', // Unmatched closing bracket "}", - "", - "", - "// This should not be yielded", + "1234567890123456789", 'console.log("End");', ]; - const expectedOutputLines = [' console.log("Hello World");', "}"]; + const expectedOutputLines = [ + ' console.log("Hello World");', + "}", + "1234567890123456789", + ]; const lines = arrayToAsyncGenerator(inputLines); const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), + stopNCharsAfterClosingBracket(lines), ); expect(outputLines).toEqual(expectedOutputLines); }); - test("should yield all lines when unmatched brackets but no double newline", async () => { + test("should stop yielding after 2 chars when unmatched closing bracket is found", async () => { + const inputLines = [ + // "function test() {", + ' console.log("Hello World");', + // Unmatched closing bracket + "}", + "12", + 'console.log("End");', + ]; + const expectedOutputLines = [' console.log("Hello World");', "}", "1"]; + const lines = arrayToAsyncGenerator(inputLines); + const outputLines = await collectLines( + stopNCharsAfterClosingBracket(lines, 2), + ); + + expect(outputLines).toEqual(expectedOutputLines); + }); + + test("should stop yielding after 4 chars when unmatched closing bracket is found, on same line", async () => { + const inputLines = [ + // "function test() {", + ' console.log("Hello World");', + // Unmatched closing bracket + "}23456", + ]; + const expectedOutputLines = [' console.log("Hello World");', "}234"]; + const lines = arrayToAsyncGenerator(inputLines); + const outputLines = await collectLines( + stopNCharsAfterClosingBracket(lines, 4), + ); + + expect(outputLines).toEqual(expectedOutputLines); + }); + + test("should yield all lines when unmatched brackets but less <20 chars after", async () => { const inputLines = [ "function test() {", ' console.log("Hello World");', @@ -76,36 +110,16 @@ describe("noDoubleNewlineAfterClosingBracket", () => { // Unmatched closing bracket ")", "// Continue code", - 'console.log("End");', ]; const lines = arrayToAsyncGenerator(inputLines); const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), + stopNCharsAfterClosingBracket(lines), ); expect(outputLines).toEqual(inputLines); }); - test("should continue yielding if unmatched closing bracket occurs after double newline", async () => { - const inputLines = [ - "function test() {", - ' console.log("Hello World");', - "}", - "", - "", - // Unmatched closing bracket after double newline - ")", - 'console.log("End");', - ]; - const lines = arrayToAsyncGenerator(inputLines); - const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), - ); - - expect(outputLines).toEqual(inputLines); - }); - - test("should yield all lines when brackets are matched even with double newline", async () => { + test("should yield all lines when brackets are matched even with many characters", async () => { const inputLines = [ "const arr = [", " 1, 2, 3,", @@ -113,52 +127,15 @@ describe("noDoubleNewlineAfterClosingBracket", () => { "", "", "console.log(arr);", + "console.log(arr);", + "console.log(arr);", + "console.log(arr);", + "console.log(arr);", + "console.log(arr);", ]; const lines = arrayToAsyncGenerator(inputLines); const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), - ); - - expect(outputLines).toEqual(inputLines); - }); - - test("should stop yielding when unmatched closing bracket occurs before double newline", async () => { - const inputLines = [ - "if (condition) {", - " doSomething();", - "}", - // Unmatched closing bracket - "}", - "", - "", - "doSomethingElse();", - ]; - const expectedOutputLines = [ - "if (condition) {", - " doSomething();", - "}", - "}", - ]; - const lines = arrayToAsyncGenerator(inputLines); - const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), - ); - - expect(outputLines).toEqual(expectedOutputLines); - }); - - test("should yield all lines when no unmatched closing brackets and double newline", async () => { - const inputLines = [ - "while (true) {", - " // Infinite loop", - "}", - "", - "", - "// Loop exited", - ]; - const lines = arrayToAsyncGenerator(inputLines); - const outputLines = await collectLines( - noDoubleNewlineAfterClosingBracket(lines), + stopNCharsAfterClosingBracket(lines), ); expect(outputLines).toEqual(inputLines); From ab1ad0ae48eeceee87043cae9a7862a1c4f70da0 Mon Sep 17 00:00:00 2001 From: Test Date: Fri, 22 Nov 2024 15:21:21 -0800 Subject: [PATCH 09/10] fix: rename edit folder fix: rename edit folder --- gui/src/pages/{edit => Edit}/index.tsx | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gui/src/pages/{edit => Edit}/index.tsx (100%) diff --git a/gui/src/pages/edit/index.tsx b/gui/src/pages/Edit/index.tsx similarity index 100% rename from gui/src/pages/edit/index.tsx rename to gui/src/pages/Edit/index.tsx From e8f2bc8ceb73eb9dcb88e1c9287b4871d35f756b Mon Sep 17 00:00:00 2001 From: Fred Bricon Date: Sat, 23 Nov 2024 19:37:00 +0100 Subject: [PATCH 10/10] Fix 'Run in terminal' button regression Signed-off-by: Fred Bricon --- .../markdown/StepContainerPreActionButtons.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gui/src/components/markdown/StepContainerPreActionButtons.tsx b/gui/src/components/markdown/StepContainerPreActionButtons.tsx index 21fafc2f5..c316e769f 100644 --- a/gui/src/components/markdown/StepContainerPreActionButtons.tsx +++ b/gui/src/components/markdown/StepContainerPreActionButtons.tsx @@ -8,7 +8,7 @@ import { import { defaultBorderRadius, vscEditorBackground } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { isJetBrains } from "../../util"; -import { isTerminalCodeBlock } from "./utils"; +import { isTerminalCodeBlock, getTerminalCommand } from "./utils"; import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip"; import { CopyIconButton } from "../gui/CopyIconButton"; import useUIConfig from "../../hooks/useUIConfig"; @@ -88,6 +88,12 @@ export default function StepContainerPreActionButtons({ }); } + async function onClickRunTerminal(): Promise { + if (shouldRunTerminalCmd) { + return ideMessenger.ide.runCommand(getTerminalCommand(codeBlockContent)); + } + } + // Handle apply keyboard shortcut useWebviewListener( "applyCodeFromChat", @@ -120,7 +126,7 @@ export default function StepContainerPreActionButtons({