Merge branch 'continuedev:main' into main

This commit is contained in:
Anoyi 2024-11-25 10:14:31 +08:00 • committed by GitHub
commit 5f1090409a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 173 additions and 195 deletions

View file

@ -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

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: OpenAI predicted outputs support
time: 2024-11-08T11:39:42.277047-08:00

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: Improve codebase retrieval with BM25
time: 2024-11-08T11:41:00.002716-08:00

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: Support for Grok from xAI
time: 2024-11-08T11:44:23.761084-08:00

View file

@ -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

View file

@ -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

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: Support for Nebius LLM provider
time: 2024-11-08T11:46:12.94828-08:00

View file

@ -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

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: Improved reference for config.json
time: 2024-11-08T11:46:49.648545-08:00

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: New @web context provider
time: 2024-11-08T11:47:53.447346-08:00

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: Updates for llama3.2
time: 2024-11-08T11:48:13.830692-08:00

View file

@ -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

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Added
body: .prompt files v2
time: 2024-11-13T17:00:06.855468-08:00

View file

@ -1,4 +0,0 @@
project: extensions/vscode
kind: Changed
body: Improved @docs crawler
time: 2024-11-08T11:45:49.381554-08:00

View file

@ -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

View file

@ -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

View file

@ -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 });

View file

@ -548,32 +548,21 @@ export async function* showWhateverWeHaveAtXMs(
}
}
export async function* noDoubleNewlineAfterClosingBracket(
export async function* stopNCharsAfterClosingBracket(
lines: LineStream,
n: number = 20,
): LineStream {
const bracketTypeCounts = new Map<string, number>();
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;
@ -582,8 +571,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;
}
}

View file

@ -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);

View file

@ -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"
}
]

View file

@ -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

View file

@ -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))
}

View file

@ -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

View file

@ -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);

View file

@ -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({
>
<XMarkIcon className="mr-1 h-4 w-4 text-red-600" />
{hasSinglePendingApplyStates ? (
<span>Reject</span>
<span>Reject ({getMetaKeyLabel()}⇧⌫)</span>
) : (
<>
<span className="sm:hidden">Reject</span>
@ -52,7 +53,7 @@ export default function AcceptRejectAllButtons({
>
<CheckIcon className="mr-1 h-4 w-4 text-green-600" />
{hasSinglePendingApplyStates ? (
<span>Accept</span>
<span>Accept ({getMetaKeyLabel()}⇧⏎)</span>
) : (
<>
<span className="sm:hidden">Accept</span>

View file

@ -598,7 +598,7 @@ function TipTapEditor(props: TipTapEditorProps) {
if (isOSREnabled) {
handleJetBrainsOSRMetaKeyIssues(e, editor);
} else {
} else if (!isJetBrains()){
await handleVSCMetaKeyIssues(e, editor);
}
};

View file

@ -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<void> {
if (shouldRunTerminalCmd) {
return ideMessenger.ide.runCommand(getTerminalCommand(codeBlockContent));
}
}
// Handle apply keyboard shortcut
useWebviewListener(
"applyCodeFromChat",
@ -120,7 +126,7 @@ export default function StepContainerPreActionButtons({
<HeaderButtonWithToolTip
text="Run in terminal"
style={{ backgroundColor: vscEditorBackground }}
onClick={onClickApply}
onClick={onClickRunTerminal}
>
<CommandLineIcon className="h-4 w-4 text-gray-400" />
</HeaderButtonWithToolTip>

View file

@ -29,7 +29,7 @@ export default function AddFileButton() {
<div className="relative">
<Listbox.Button
ref={buttonRef}
className="bg-lightgray/10 border-lightgray flex cursor-pointer items-center justify-between rounded-md border-[0.5px] border-solid px-0 shadow-sm transition-colors"
className="bg-vsc-editor-background border-lightgray/50 flex cursor-pointer items-center justify-between rounded-md border border-solid px-0 shadow-sm transition-colors"
>
<div
className="flex items-center gap-1 px-1.5 hover:brightness-125"
@ -45,17 +45,15 @@ export default function AddFileButton() {
</span>
</div>
<div className="border-lightgray h-4 w-[1px] border-y-0 border-l-0 border-r border-solid" />
<div className="border-lightgray/50 h-4 w-[1px] border-y-0 border-l-0 border-r border-solid" />
<ChevronDownIcon className="text-vsc-foreground h-2.5 w-2.5 cursor-pointer px-1 brightness-75 hover:brightness-125" />
</Listbox.Button>
<Listbox.Options
className={`bg-vsc-input-background border-lightgray absolute right-0 top-full z-50 mt-1 min-w-fit whitespace-nowrap rounded-md border border-solid px-1 py-0 shadow-lg`}
>
<Listbox.Options className="bg-vsc-editor-background border-lightgray/50 absolute right-0 top-full z-50 mt-1 min-w-fit whitespace-nowrap rounded-md border border-solid px-1 py-0 shadow-lg">
<Listbox.Option
value="addAllFiles"
className="text-vsc-foreground hover:bg-lightgray/33 block w-full cursor-pointer px-2 py-1 text-left text-[10px] brightness-75 hover:brightness-125"
className="text-vsc-foreground block w-full cursor-pointer px-2 py-1 text-left text-[10px] brightness-75 hover:brightness-125"
>
Add all open files
</Listbox.Option>

View file

@ -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) => (
<CodeToEditListItem
@ -51,13 +51,13 @@ export default function WorkingSet() {
return (
<div className="bg-vsc-editor-background border-vsc-input-border mx-1 flex flex-col rounded-t-lg border border-b-0 border-solid p-1">
<div className="text-lightgray flex items-center justify-between gap-1.5 px-1 py-1.5 text-xs">
<div className="text-lightgray flex items-center justify-between gap-1.5 py-1.5 pl-3 pr-2 text-xs">
<span>{title}</span>
<AddFileButton />
</div>
{hasCodeToEdit && (
<ul className="no-scrollbar mb-1.5 mt-1 max-h-[50vh] list-outside list-none space-y-1.5 overflow-y-auto pl-0">
{codeToEdit.length > 0 && (
<ul className="no-scrollbar mb-1.5 mt-1 max-h-[50vh] list-outside list-none overflow-y-auto pl-0">
{codeToEditItems}
</ul>
)}

View file

@ -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 =
@ -53,7 +56,7 @@ export default function CodeToEditListItem({
return (
<li
className="flex cursor-pointer flex-col"
className="group flex cursor-pointer flex-col"
onClick={() => setShowCodeSnippet((showCodeSnippet) => !showCodeSnippet)}
>
<div
@ -88,7 +91,7 @@ export default function CodeToEditListItem({
{title}
</span>
</div>
<div className="flex gap-1.5">
<div className="invisible flex gap-1.5 group-hover:visible">
<XMarkIcon
onClick={(e) => {
e.stopPropagation();
@ -98,6 +101,7 @@ export default function CodeToEditListItem({
/>
</div>
</div>
{showCodeSnippet && (
<div className="max-h-[25vh] overflow-y-auto px-1 py-2">
<NoPaddingWrapper>

View file

@ -11,6 +11,7 @@ public class Calculator {
return this;
}
public double getResult() {
return result;
}