Merge branch 'main' into pe/tsc-fix-find-widget

This commit is contained in:
Test 2024-11-13 18:27:52 -08:00
commit 7402fe02ca
43 changed files with 548 additions and 140 deletions

View file

@ -0,0 +1,4 @@
project: extensions/vscode
kind: Added
body: .continuerules file to set system prompt
time: 2024-11-13T16:59:58.544875-08:00

View file

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

View file

@ -14,7 +14,7 @@ jobs:
uses: pozil/auto-assign-issue@v2
with:
repo-token: ${{ secrets.CI_GITHUB_TOKEN }}
assignees: sestinj,Patrick-Erichsen
assignees: sestinj,Patrick-Erichsen,tomasz-stefaniak,RomneyDa
numOfAssignee: 1
- name: "Add default labels"
uses: actions-ecosystem/action-add-labels@v1

1
.instructions Normal file
View file

@ -0,0 +1 @@
Give concise responses.

View file

@ -7,7 +7,7 @@ Continue now provides support for tab autocomplete in [VS Code](https://marketpl
We recommend setting up tab-autocomplete with a local Ollama instance. To do this, first download the latest version of Ollama from [here](https://ollama.ai). Then, run the following command to download our recommended model:
```bash
ollama run starcoder:3b
ollama run qwen2.5-coder:1.5b
```
Once it has been downloaded, you should begin to see completions in VS Code.
@ -17,9 +17,9 @@ Once it has been downloaded, you should begin to see completions in VS Code.
You can also set up tab-autocomplete with a local LM Studio instance by following these steps:
1. Download the latest version of LM Studio from [here](https://lmstudio.ai/)
2. Download a model (e.g. search for `second-state/StarCoder2-3B-GGUF` and choose one of the options there)
2. Download a model (e.g. search for `Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF` and choose one of the options there)
3. Go to the server section (button is on the left), select your model from the dropdown at the top, and click "Start Server"
4. Go to the "My Models" section (button is on the left), find your selected model, and copy the name the path (example: `second-state/StarCoder2-3B-GGUF/starcoder2-3b-Q8_0.gguf`); this will be used as the "model" attribute in Continue
4. Go to the "My Models" section (button is on the left), find your selected model, and copy the name the path (example: `Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF/qwen2.5-coder-1.5b-instruct-q4_k_m.gguf`); this will be used as the "model" attribute in Continue
5. Go to Continue and modify the configurations for a [custom model](#setting-up-a-custom-model)
6. Set the "provider" to `lmstudio` and the "model" to the path copied earlier
@ -28,8 +28,8 @@ Example:
```json title="config.json"
{
"tabAutocompleteModel": {
"title": "Starcoder2 3b",
"model": "second-state/StarCoder2-3B-GGUF/starcoder2-3b-Q8_0.gguf",
"title": "Qwen2.5-Coder 1.5b",
"model": "Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF",
"provider": "lmstudio",
},
...
@ -69,11 +69,9 @@ If you aren't yet familiar with the available options, you can learn more in our
### What model should I use?
If you are running the model locally, we recommend `starcoder:3b`.
If you are running the model locally, we recommend `qwen2.5-coder:1.5b`.
If you find it to be too slow, you should try `deepseek-coder:1.3b-base`.
If you have a bit more compute, or are running a model in the cloud, you can upgrade to `deepseek-coder:6.7b-base`.
If you have a bit more compute, or are running a model in the cloud, you can upgrade to `qwen2.5-coder:7b`.
Regardless of what you are willing to spend, we do not recommend using GPT or Claude for autocomplete. Learn why [below](#i-want-better-completions-should-i-use-gpt-4).
@ -83,7 +81,7 @@ The following can be configured in `config.json`:
### `tabAutocompleteModel`
This is just another object like the ones in the `"models"` array of `config.json`. You can choose and configure any model you would like, but we strongly suggest using a small model made for tab-autocomplete, such as `deepseek-1b`, `starcoder-1b`, or `starcoder-3b`.
This is just another object like the ones in the `"models"` array of `config.json`. You can choose and configure any model you would like, but we strongly suggest using a small model made for tab-autocomplete, such as `deepseek-1b`, `qwen2.5-coder:1.5b`, or `starcoder-3b`.
### `tabAutocompleteOptions`
@ -105,7 +103,7 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
"tabAutocompleteModel": {
"title": "Tab Autocomplete Model",
"provider": "ollama",
"model": "starcoder:3b",
"model": "qwen2.5-coder:1.5b",
"apiBase": "https://<my endpoint>"
},
"tabAutocompleteOptions": {
@ -128,7 +126,7 @@ Follow these steps to ensure that everything is set up correctly:
1. Make sure you have the "Enable Tab Autocomplete" setting checked (in VS Code, you can toggle by clicking the "Continue" button in the status bar).
2. Make sure you have downloaded Ollama.
3. Run `ollama run starcoder:3b` to verify that the model is downloaded.
3. Run `ollama run qwen2.5-coder:1.5b` to verify that the model is downloaded.
4. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere.
5. Make sure that you aren't also using another Ollama model for chat. This will cause Ollama to constantly load and unload the models from memory, resulting in slow responses (or none at all) for both.
6. Check the output of the logs to find any potential errors (cmd/ctrl+shift+p -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/logs/core.log in JetBrains).

View file

@ -9,6 +9,21 @@ import { AstPath } from "../../util/ast";
import { ImportDefinitionsService } from "../ImportDefinitionsService";
import { AutocompleteSnippet } from "../ranking";
function getSyntaxTreeString(
node: Parser.SyntaxNode,
indent: string = "",
): string {
let result = "";
const nodeInfo = `${node.type} [${node.startPosition.row}:${node.startPosition.column} - ${node.endPosition.row}:${node.endPosition.column}]`;
result += `${indent}${nodeInfo}\n`;
for (const child of node.children) {
result += getSyntaxTreeString(child, indent + " ");
}
return result;
}
export class RootPathContextService {
private cache = new LRUCache<string, AutocompleteSnippet[]>({
max: 100,
@ -28,6 +43,7 @@ export class RootPathContextService {
"function_declaration",
"function_definition",
"method_definition",
"method_declaration",
"class_declaration",
"class_definition",
]);
@ -58,12 +74,17 @@ export class RootPathContextService {
this.importDefinitionsService.get(filepath);
break;
default:
// const type = node.type;
// debugger;
// console.log(getSyntaxTreeString(node));
query = await getQueryForFile(
filepath,
`root-path-context-queries/${node.type}`,
);
break;
}
const type = node.type;
if (!query) {
return snippets;
@ -115,6 +136,8 @@ export class RootPathContextService {
RootPathContextService.TYPES_TO_USE.has(node.type),
)) {
const key = RootPathContextService.keyFromNode(parentKey, astNode);
// const type = astNode.type;
// debugger;
const foundInCache = this.cache.get(key);
const newSnippets =

View file

@ -1,29 +1,8 @@
import { TYPESCRIPT_TEST_CASES } from "./testCases/typescript";
import { testRootPathContext } from "./testUtils";
const TEST_CASES = [
{
nodeType: "function_declaration",
fileName: "file1.ts",
language: "TypeScript",
cursorPosition: { line: 10, character: 24 },
definitionPositions: [
{ row: 9, column: 34 }, // Person
{ row: 9, column: 44 }, // Address
],
},
{
nodeType: "method_declaration",
fileName: "file1.ts",
language: "TypeScript",
cursorPosition: { line: 22, character: 30 },
definitionPositions: [
{ row: 13, column: 29 }, // BaseClass
{ row: 13, column: 55 }, // FirstInterface
{ row: 13, column: 72 }, // SecondInterface
{ row: 21, column: 33 }, // Person
{ row: 21, column: 43 }, // Address
],
},
...TYPESCRIPT_TEST_CASES,
{
nodeType: "function_definition",
fileName: "file1.py",
@ -46,6 +25,39 @@ const TEST_CASES = [
{ row: 11, column: 59 }, // Address
],
},
{
nodeType: "function_definition",
fileName: "file1.php",
language: "PHP",
cursorPosition: { line: 12, character: 32 },
definitionPositions: [
{ row: 10, column: 26 }, // Person
{ row: 10, column: 44 }, // Address
],
},
{
nodeType: "method_declaration",
fileName: "file1.php",
language: "PHP",
cursorPosition: { line: 26, character: 35 },
definitionPositions: [
{ row: 15, column: 29 }, // BaseClass
{ row: 15, column: 55 }, // FirstInterface
{ row: 15, column: 72 }, // SecondInterface
{ row: 25, column: 43 }, // Person
{ row: 25, column: 61 }, // Address
],
},
{
nodeType: "function_declaration",
fileName: "file1.go",
language: "Go",
cursorPosition: { line: 7, character: 21 },
definitionPositions: [
{ row: 6, column: 33 }, // models.User
{ row: 6, column: 50 }, // models.Address
],
},
];
describe("RootPathContextService", () => {

View file

@ -7,10 +7,6 @@ import {
// @ts-ignore
} from "./types";
function getAddress(person: Person): Address {
return person.address;
}
class Group extends BaseClass implements FirstInterface, SecondInterface {
people: Person[];
@ -20,6 +16,18 @@ class Group extends BaseClass implements FirstInterface, SecondInterface {
}
getPersonAddress(person: Person): Address {
return getAddress(person);
return person.address;
}
getHardcodedAddress(): Address {
return { street: "123 Main St", city: "Anytown" };
}
addPerson(person: Person) {
this.people = [...this.people, person];
}
addPeople(people: Person[]) {
this.people = [...this.people, ...people];
}
}

View file

@ -0,0 +1,9 @@
package main
import (
"core/autocomplete/context/root-path-context/test/files/models"
)
func getAddress(user *models.User) *models.Address {
return user.Address
}

View file

@ -0,0 +1,32 @@
<?php
namespace BaseNamespace;
use BaseNamespace\BaseClass;
use BaseNamespace\Interfaces\FirstInterface;
use BaseNamespace\Interfaces\SecondInterface;
use BaseNamespace\Person;
use BaseNamespace\Address;
function getAddress(Person $person): Address
{
return $person->getAddress();
}
class Group extends BaseClass implements FirstInterface, SecondInterface
{
private array $people;
public function __construct(array $people)
{
parent::__construct();
$this->people = $people;
}
public function getPersonAddress(Person $person): Address
{
return getAddress($person);
}
}
?>

View file

@ -0,0 +1,25 @@
import {
Address,
Person,
// @ts-ignore
} from "./types";
function getAddress(person: Person): Address {
return person.address;
}
function getFirstAddress(people: Person[]): Address {
return people[0].address;
}
function logPerson(person: Person) {
console.log(`Name: ${person.name}, Age: ${person.age}`);
}
function getHardcodedAddress(): Address {
return { street: "123 Main St", city: "Anytown", zipCode: "12345" };
}
function getAddresses(people: Person[]): Address[] {
return people[0].address;
}

View file

@ -0,0 +1,89 @@
export const TYPESCRIPT_TEST_CASES = [
{
nodeType: "function_declaration with a param and a return type",
fileName: "functions.ts",
language: "TypeScript",
cursorPosition: { line: 7, character: 24 },
definitionPositions: [
{ row: 6, column: 34 }, // Person
{ row: 6, column: 44 }, // Address
],
},
{
nodeType: "function_declaration with array param",
fileName: "functions.ts",
language: "TypeScript",
cursorPosition: { line: 11, character: 27 },
definitionPositions: [
{ row: 10, column: 39 }, // Person
{ row: 10, column: 51 }, // Address
],
},
{
nodeType: "function_declaration without return type",
fileName: "functions.ts",
language: "TypeScript",
cursorPosition: { line: 15, character: 58 },
definitionPositions: [
{ row: 14, column: 33 }, // Person
],
},
{
nodeType: "function_declaration without params",
fileName: "functions.ts",
language: "TypeScript",
cursorPosition: { line: 19, character: 70 },
definitionPositions: [
{ row: 18, column: 39 }, // Person
],
},
{
nodeType: "method_declaration",
fileName: "class.ts",
language: "TypeScript",
cursorPosition: { line: 18, character: 26 },
definitionPositions: [
{ row: 9, column: 29 }, // BaseClass
{ row: 9, column: 55 }, // FirstInterface
{ row: 9, column: 72 }, // SecondInterface
{ row: 17, column: 33 }, // Person
{ row: 17, column: 43 }, // Address
],
},
{
nodeType: "method_declaration without arguments",
fileName: "class.ts",
language: "TypeScript",
cursorPosition: { line: 22, character: 54 },
definitionPositions: [
{ row: 9, column: 29 }, // BaseClass
{ row: 9, column: 55 }, // FirstInterface
{ row: 9, column: 72 }, // SecondInterface
{ row: 21, column: 32 }, // Address
],
},
{
nodeType: "method_declaration without return type",
fileName: "class.ts",
language: "TypeScript",
cursorPosition: { line: 26, character: 43 },
definitionPositions: [
{ row: 9, column: 29 }, // BaseClass
{ row: 9, column: 55 }, // FirstInterface
{ row: 9, column: 72 }, // SecondInterface
{ row: 25, column: 26 }, // Person
],
},
{
nodeType: "method_declaration with array type arguments",
fileName: "class.ts",
language: "TypeScript",
cursorPosition: { line: 30, character: 46 },
definitionPositions: [
{ row: 9, column: 29 }, // BaseClass
{ row: 9, column: 55 }, // FirstInterface
{ row: 9, column: 72 }, // SecondInterface
{ row: 29, column: 26 }, // Person
],
},
];

View file

@ -157,4 +157,20 @@ describe("stopAtStopTokens", () => {
expect(output.join("")).toBe("Hello world!");
});
it("should handle stop token when remaining buffer is smaller than maximum stop token length", async () => {
const mockStream = createMockStream(["Hello world!STOP"]);
const stopTokens: string[] = [
"STOP",
"STOP_TOKEN_THAT_IS_LARGER_THAN_BUFFER",
];
const result = stopAtStopTokens(mockStream, stopTokens);
const output = [];
for await (const char of result) {
output.push(char);
}
expect(output.join("")).toBe("Hello world!");
});
});

View file

@ -70,7 +70,8 @@ export async function* noFirstCharNewline(stream: AsyncGenerator<string>) {
* 2. Otherwise, buffers incoming chunks and checks for stop tokens.
* 3. Yields characters one by one if no stop token is found at the start of the buffer.
* 4. Stops yielding and returns if a stop token is encountered.
* 5. After the stream ends, yields any remaining buffered characters.
* 5. After the stream ends, filters encountered stop tokens in remaining buffer.
* 6. Yields any remaining buffered characters.
*/
export async function* stopAtStopTokens(
stream: AsyncGenerator<string>,
@ -106,6 +107,10 @@ export async function* stopAtStopTokens(
}
}
}
// Filter out the possible stop tokens from remaining buffer
stopTokens.forEach((token) => {
buffer = buffer.replace(token, "");
});
// Yield any remaining characters in the buffer
for (const char of buffer) {

View file

@ -0,0 +1,27 @@
import { IDE } from "..";
export const SYSTEM_PROMPT_DOT_FILE = ".continuerules";
export async function getSystemPromptDotFile(ide: IDE): Promise<string | null> {
const dirs = await ide.getWorkspaceDirs();
let prompts: string[] = [];
const pathSep = await ide.pathSep();
for (const dir of dirs) {
const dotFile = `${dir}${pathSep}${SYSTEM_PROMPT_DOT_FILE}`;
if (await ide.fileExists(dotFile)) {
try {
const content = await ide.readFile(dotFile);
prompts.push(content);
} catch (e) {
// ignore if file doesn't exist
}
}
}
if (!prompts.length) {
return null;
}
return prompts.join("\n\n");
}

View file

@ -64,6 +64,7 @@ import {
defaultSlashCommandsJetBrains,
defaultSlashCommandsVscode,
} from "./default";
import { getSystemPromptDotFile } from "./getSystemPromptDotFile";
import {
DEFAULT_PROMPTS_FOLDER,
getPromptFiles,
@ -735,6 +736,11 @@ async function loadFullConfigNode(
return { errors, config: undefined, configLoadInterrupted: true };
}
const systemPromptDotFile = await getSystemPromptDotFile(ide);
if (systemPromptDotFile) {
serialized.systemMessage = systemPromptDotFile;
}
// Convert serialized to intermediate config
let intermediate = await serializedToIntermediateConfig(serialized, ide);

View file

@ -4,7 +4,7 @@ import { FREE_TRIAL_MODELS } from "./default";
export const TRIAL_FIM_MODEL = "codestral-latest";
export const ONBOARDING_LOCAL_MODEL_TITLE = "Ollama";
export const LOCAL_ONBOARDING_FIM_MODEL = "starcoder2:3b";
export const LOCAL_ONBOARDING_FIM_MODEL = "qwen2.5-coder:1.5b";
export const LOCAL_ONBOARDING_CHAT_MODEL = "llama3.1:8b";
export const LOCAL_ONBOARDING_CHAT_TITLE = "Llama 3.1 8B";
@ -35,7 +35,7 @@ export function setupLocalConfig(
...config.models.filter((model) => model.provider !== "free-trial"),
],
tabAutocompleteModel: {
title: "Starcoder 3b",
title: "Qwen2.5-Coder 1.5B",
provider: "ollama",
model: LOCAL_ONBOARDING_FIM_MODEL,
},

View file

@ -13,13 +13,14 @@ class ContinueProxy extends OpenAI {
static providerName: ModelProvider = "continue-proxy";
static defaultOptions: Partial<LLMOptions> = {
useLegacyCompletionsEndpoint: false,
requestOptions: {
headers: {
"x-continue-unique-id": Telemetry.uniqueId,
},
},
};
protected _getHeaders() {
const headers: any = super._getHeaders();
headers["x-continue-unique-id"] = Telemetry.uniqueId;
return headers;
}
supportsCompletions(): boolean {
return false;
}

View file

@ -1,46 +1,42 @@
import path from "path";
import { IDE } from "../..";
import { GlobalContext } from "../../util/GlobalContext";
import { DEFAULT_PROMPTS_FOLDER_V2 } from "./getPromptFiles";
import { getPathModuleForIde } from "../../util/pathModule";
const FIRST_TIME_DEFAULT_PROMPT_FILE = `# This is an example ".prompt" file
# It is used to define and reuse prompts within Continue
# Continue will automatically create a context provider for each prompt in the .prompts folder
# Each .prompt file can be accessed by typing "@prompts" in the Chat input
# A prompt file consists of two parts:
# 1. Everything above the "---" is YAML. Here you can set "temperature", "description", and other options
# 2. Everything below the "---" is the prompt body
# If you don't want to set any options, you don't need to include the "---"
# If you do not want to set any options, you do not need to include the "---"
# In the body, you can reference:
# 1. Files, using either absolute or relative (based on the workspace root) paths
# e.g. @README.md
# e.g. @src/test/test.py
# e.g. @/Users/me/Desktop/my-project/src/test/test.py
# 2. URLs
# e.g. https://example.com
# 3. Some context providers, like
# e.g. @currentFile
# e.g. @os
# e.g. @repo-map
# 1. Files, using either absolute or relative paths (based on the workspace root)
# @README.md
# @src/test/test.py
# @/Users/me/Desktop/my-project/src/test/test.py
# 2. URLs, for example
# @https://example.com
# 3. Context providers, for example
# @currentFile
# @os
# @repo-map
# To learn more, see the full .prompt file reference: https://docs.continue.dev/features/prompt-files
name: Example
# For example, here is how you would write a .prompt
name: Example
description: Example prompt file
version: 2
---
@README.md
Please reference the above README.md file to understand the current project.
`;
const DEFAULT_PROMPT_FILE = `version: 2
---
`;
Here is information about the current repo:
@README.md`;
const DEFAULT_PROMPT_FILE = "";
export async function createNewPromptFileV2(
ide: IDE,
@ -52,9 +48,11 @@ export async function createNewPromptFileV2(
"No workspace directories found. Make sure you've opened a folder in your IDE.",
);
}
const baseDir = path.join(
const pathModule = await getPathModuleForIde(ide);
const baseDir = pathModule.join(
workspaceDirs[0],
promptPath ?? DEFAULT_PROMPTS_FOLDER_V2,
promptPath ?? pathModule.join(".continue", "prompts"),
);
// Find the first available filename
@ -62,7 +60,10 @@ export async function createNewPromptFileV2(
let promptFilePath: string;
do {
const suffix = counter === 0 ? "" : `-${counter}`;
promptFilePath = path.join(baseDir, `new-prompt-file${suffix}.prompt`);
promptFilePath = pathModule.join(
baseDir,
`new-prompt-file${suffix}.prompt`,
);
counter++;
} while (await ide.fileExists(promptFilePath));

View file

@ -1,7 +1,6 @@
import path from "path";
import { IDE } from "../..";
import { walkDir } from "../../indexing/walkDir";
import { getPathModuleForIde } from "../../util/pathModule";
import { readAllGlobalPromptFiles } from "../../util/paths";
async function getPromptFilesFromDir(
@ -27,20 +26,23 @@ async function getPromptFilesFromDir(
}
}
export const DEFAULT_PROMPTS_FOLDER_V2 = ".prompts";
export async function getAllPromptFilesV2(
ide: IDE,
overridePromptFolder?: string,
): Promise<{ path: string; content: string }[]> {
const workspaceDirs = await ide.getWorkspaceDirs();
let promptFiles: { path: string; content: string }[] = [];
const pathModule = await getPathModuleForIde(ide);
promptFiles = (
await Promise.all(
workspaceDirs.map((dir) =>
getPromptFilesFromDir(
ide,
path.join(dir, overridePromptFolder ?? DEFAULT_PROMPTS_FOLDER_V2),
pathModule.join(
dir,
overridePromptFolder ?? pathModule.join(".continue", "prompts"),
),
),
),
)

View file

@ -1,7 +1,7 @@
import { ContextItem, ContextProviderExtras } from "../..";
import { contextProviderClassFromName } from "../../context/providers";
import URLContextProvider from "../../context/providers/URLContextProvider";
import { getBasename } from "../../util";
import { getPreambleAndBody } from "./parse";
async function resolveAttachment(
@ -15,6 +15,13 @@ async function resolveAttachment(
if (contextProvider) {
const items = await contextProvider.getContextItems("", extras);
return items;
} else {
// Just instantiate it here
const providerClass = contextProviderClassFromName(name) as any;
if (providerClass) {
const providerInstance = new providerClass({});
return providerInstance.getContextItems("", extras);
}
}
// Files

13
core/util/pathModule.ts Normal file
View file

@ -0,0 +1,13 @@
import { PlatformPath, posix, win32 } from "node:path";
import { IDE } from "..";
export type PathSep = "/" | "\\";
function getPathModuleFromPathSep(pathSep: PathSep): PlatformPath {
return pathSep === "/" ? posix : win32;
}
export async function getPathModuleForIde(ide: IDE): Promise<PlatformPath> {
const pathSep = await ide.pathSep();
return getPathModuleFromPathSep(pathSep as PathSep);
}

View file

@ -327,7 +327,7 @@ export function getPromptLogsPath(): string {
}
export function getGlobalPromptsPath(): string {
return path.join(getContinueGlobalPath(), ".prompts");
return path.join(getContinueGlobalPath(), "prompts");
}
export function readAllGlobalPromptFiles(

View file

@ -26,26 +26,23 @@ The API keys for Codestral and the general Mistral APIs are different. If you ar
## Local, offline / self-hosted experience
For those preferring local execution or self-hosting,`StarCoder2-3b` offers a good balance of performance and quality for most users:
For those preferring local execution or self-hosting,`Qwen2.5-Coder 1.5B` offers a good balance of performance and quality for most users:
```json title="config.json""
{
"tabAutocompleteModel": {
"title": "StarCoder2-3b",
"model": "starcoder2:3b",
"title": "Qwen2.5-Coder 1.5B",
"model": "qwen2.5-coder:1.5b",
"provider": "ollama"
}
}
```
## Alternative experiences
- Completions too slow? Try `deepseek-coder:1.3b-base` for quicker completions on less powerful hardware
- Have more compute? Use `deepseek-coder:6.7b-base` for potentially higher-quality suggestions
Have more compute? Use `qwen2.5-coder:7b` for potentially higher-quality suggestions.
:::note
For LM Studio users, navigate to the "My Models" section, find your desired model, and copy the path (e.g., second-state/StarCoder2-3B-GGUF/starcoder2-3b-Q8_0.gguf). Use this path as the `model` value in your configuration.
For LM Studio users, navigate to the "My Models" section, find your desired model, and copy the path (e.g., `Qwen/Qwen2.5-Coder-1.5B-Instruct-GGUF/wen2.5-coder-1.5b-instruct-q4_k_m.gguf`). Use this path as the `model` value in your configuration.
:::

View file

@ -23,7 +23,7 @@ If you want to have the best autocomplete experience, we recommend using Codestr
If you'd like to run your autocomplete model locally, we recommend using Ollama. To do this, first download the latest version of Ollama from [here](https://ollama.ai). Then, run the following command to download our recommended model:
```bash
ollama run starcoder2:3b
ollama run qwen2.5-coder:1.5b
```
Once it has been downloaded, you should begin to see completions in VS Code.
@ -37,7 +37,7 @@ All of the configuration options available for chat models are available to use
"tabAutocompleteModel": {
"title": "Tab Autocomplete Model",
"provider": "ollama",
"model": "starcoder2:3b",
"model": "qwen2.5-coder:1.5b",
"apiBase": "https://<my endpoint>"
},
...
@ -52,7 +52,7 @@ The following can be configured in `config.json`:
### `tabAutocompleteModel`
This is just another object like the ones in the `"models"` array of `config.json`. You can choose and configure any model you would like, but we strongly suggest using a small model made for tab-autocomplete, such as `deepseek-1b`, `starcoder-1b`, or `starcoder2-3b`.
This is just another object like the ones in the `"models"` array of `config.json`. You can choose and configure any model you would like, but we strongly suggest using a small model made for tab-autocomplete, such as `deepseek-1b`, `qwen2.5-coder:1.5b`, or `starcoder2-3b`.
### `tabAutocompleteOptions`
@ -78,7 +78,7 @@ This object allows you to customize the behavior of tab-autocomplete. The availa
"tabAutocompleteModel": {
"title": "Tab Autocomplete Model",
"provider": "ollama",
"model": "starcoder2:3b",
"model": "qwen2.5-coder:1.5b",
"apiBase": "https://<my endpoint>"
},
"tabAutocompleteOptions": {
@ -101,16 +101,12 @@ Follow these steps to ensure that everything is set up correctly:
1. Make sure you have the "Enable Tab Autocomplete" setting checked (in VS Code, you can toggle by clicking the "Continue" button in the status bar, and in JetBrains by going to Settings -> Tools -> Continue).
2. Make sure you have downloaded Ollama.
3. Run `ollama run starcoder2:3b` to verify that the model is downloaded.
3. Run `ollama run qwen2.5-coder:1.5b` to verify that the model is downloaded.
4. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere.
5. Check the output of the logs to find any potential errors: <kbd>cmd/ctrl</kbd> + <kbd>shift</kbd> + <kbd>P</kbd> -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/logs/core.log in JetBrains.
6. Check VS Code settings to make sure that `"editor.inlineSuggest.enabled"` is set to `true` (use <kbd>cmd/ctrl</kbd> + <kbd>,</kbd> then search for this and check the box)
7. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible.
### Completions are slow
Depending on your hardware, you may want to try a smaller, faster model. If 3b isn't working for you we recommend trying `deepseek-coder:1.3b-base`.
### Completions are only ever single-line
To ensure that you receive multi-line completions, you can set `"multilineCompletions": "always"` in `tabAutocompleteOptions`. By default, it is `"auto"`. If you still find that you are only seeing single-line completions, this may be because some models tend to produce shorter completions when starting in the middle of a file. You can try temporarily moving text below your cursor out of your active file, or switching to a larger model.

View file

@ -23,14 +23,14 @@ We recommend configuring **Llama3.1 8B** as your chat model.
## Autocomplete model
We recommend configuring **StarCoder2 3B** as your autocomplete model.
We recommend configuring **Qwen2.5-Coder 1.5B** as your autocomplete model.
```json title="config.json"
{
"tabAutocompleteModel": {
"title": "StarCoder2 3B",
"title": "Qwen2.5-Coder 1.5B",
"provider": "ollama",
"model": "starcoder2:3b"
"model": "qwen2.5-coder:1.5b"
}
}
```

View file

@ -13,4 +13,4 @@ In Continue, these models are used to display inline [Autocomplete](../../autoco
If you have the ability to use any model, we recommend `Codestral` with [Mistral](../model-providers/top-level/mistral.md#autocomplete-model) or [Vertex AI](../model-providers/top-level/vertexai.md#autocomplete-model).
If you want to run a model locally, we recommend `Starcoder2-3B` with [Ollama](../model-providers/top-level/ollama.md#autocomplete-model).
If you want to run a model locally, we recommend `Qwen2.5-Coder 1.5B` with [Ollama](../model-providers/top-level/ollama.md#autocomplete-model).

View file

@ -71,7 +71,6 @@ private fun getTutorialFileName(): String {
}
class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
private val coroutineScope = CoroutineScope(Dispatchers.IO)
override fun runActivity(project: Project) {
removeShortcutFromAction(getPlatformSpecificKeyStroke("J"))
@ -110,6 +109,7 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
}
private fun initializePlugin(project: Project) {
val coroutineScope = CoroutineScope(Dispatchers.IO)
val continuePluginService = ServiceManager.getService(
project,
ContinuePluginService::class.java
@ -234,7 +234,5 @@ class ContinuePluginStartupActivity : StartupActivity, Disposable, DumbAware {
}
override fun dispose() {
// Cleanup resources here
coroutineScope.cancel()
}
}

View file

@ -19,7 +19,7 @@ class CoreMessenger(
private val project: Project,
continueCorePath: String,
private val ideProtocolClient: IdeProtocolClient,
coroutineScope: CoroutineScope
val coroutineScope: CoroutineScope
) {
private var writer: Writer? = null
private var reader: BufferedReader? = null
@ -232,4 +232,11 @@ class CoreMessenger(
}
}
}
fun killSubProcess() {
process?.isAlive?.let {
exitCallbacks.clear()
process?.destroy()
}
}
}

View file

@ -105,7 +105,7 @@ class AsyncFileSaveListener(private val ideProtocolClient: IdeProtocolClient) :
for (event in events) {
if (event.path.endsWith(".continue/config.json") || event.path.endsWith(".continue/config.ts") || event.path.endsWith(
".continue\\config.json"
) || event.path.endsWith(".continue\\config.ts") || event.path.endsWith(".continuerc.json")
) || event.path.endsWith(".continue\\config.ts") || event.path.endsWith(".continuerc.json") || event.path.endsWith(".continuerc.json")
) {
return object : AsyncFileListener.ChangeApplier {
override fun afterVfsChange() {

View file

@ -34,6 +34,10 @@ class ContinuePluginService(project: Project) : Disposable, DumbAware {
override fun dispose() {
coroutineScope.cancel()
coreMessenger?.coroutineScope?.let {
it.cancel()
coreMessenger?.killSubProcess()
}
}
fun sendToWebview(

View file

@ -7,8 +7,6 @@ and is generated by [Changie](https://github.com/miniscruff/changie).
Pre-release Changes
### Added
* New Edit mode in sidebar (cmd/ctrl+I)
* Significantly faster and more accurate docs crawler by default
* OpenAI predicted outputs support
* Improve codebase retrieval with BM25
* Support for Grok from xAI
@ -19,12 +17,19 @@ Pre-release Changes
* Improved reference for config.json
* New @web context provider
* Updates for llama3.2
* .continuerules file to set system prompt
* .prompt files v2
### Changed
* Improved @docs crawler
* Many improvements to make autocomplete more eager
### Fixed
* Brought back the Apply button for all code blocks
## 0.8.56 - 2024-11-08
### Added
* New Edit mode in sidebar (cmd/ctrl+I)
* Significantly faster and more accurate docs crawler by default
## 0.8.55 - 2024-10-25
### Added
* Web context provider

View file

@ -772,6 +772,11 @@
"mistral-tiny",
"mistral-small",
"mistral-medium",
"qwen2.5-coder:1.5b",
"qwen2.5-coder:3b",
"qwen2.5-coder:7b",
"qwen2.5-coder:14b",
"qwen2.5-coder:32b",
"AUTODETECT"
]
},
@ -1028,7 +1033,12 @@
"stable-code-3b",
"starcoder-1b",
"starcoder-3b",
"starcoder2-3b"
"starcoder2-3b",
"qwen2.5-coder:1.5b",
"qwen2.5-coder:3b",
"qwen2.5-coder:7b",
"qwen2.5-coder:14b",
"qwen2.5-coder:32b"
]
},
{
@ -1081,6 +1091,11 @@
"starcoder-1b",
"starcoder-3b",
"starcoder2-3b",
"qwen2.5-coder:1.5b",
"qwen2.5-coder:3b",
"qwen2.5-coder:7b",
"qwen2.5-coder:14b",
"qwen2.5-coder:32b",
"AUTODETECT"
]
},
@ -1400,7 +1415,12 @@
"stable-code-3b",
"starcoder-1b",
"starcoder-3b",
"starcoder2-3b"
"starcoder2-3b",
"qwen2.5-coder:1.5b",
"qwen2.5-coder:3b",
"qwen2.5-coder:7b",
"qwen2.5-coder:14b",
"qwen2.5-coder:32b"
]
},
{
@ -2710,8 +2730,8 @@
},
"tabAutocompleteModel": {
"title": "Tab Autocomplete Model",
"markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder2:3b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.",
"x-intellij-html-description": "The model used for tab autocompletion. If undefined, Continue will default to using starcoder2:3b on a local Ollama instance.<br><br><i>IMPORTANT</i>:<br><br>If you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.",
"markdownDescription": "The model used for tab autocompletion. If undefined, Continue will default to using qwen2.5-coder:1.5b on a local Ollama instance.\n\n*IMPORTANT*:\n\nIf you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.",
"x-intellij-html-description": "The model used for tab autocompletion. If undefined, Continue will default to using qwen2.5-coder:1.5b on a local Ollama instance.<br><br><i>IMPORTANT</i>:<br><br>If you use a custom model, ensure that it is one trained for fill-in-the-middle completions. An instruct model is typically not well-suited to autocomplete and you may receive unsatisfactory completions.",
"default": {
"title": "Tab Autocomplete Model",
"provider": "ollama",

View file

@ -2,7 +2,7 @@
"name": "continue",
"icon": "media/icon.png",
"author": "Continue Dev, Inc",
"version": "0.9.228",
"version": "0.9.229",
"repository": {
"type": "git",
"url": "https://github.com/continuedev/continue"

View file

@ -37,6 +37,7 @@ import { VsCodeIde } from "../VsCodeIde";
import { VsCodeMessenger } from "./VsCodeMessenger";
import { SYSTEM_PROMPT_DOT_FILE } from "core/config/getSystemPromptDotFile";
import type { VsCodeWebviewProtocol } from "../webviewProtocol";
export class VsCodeExtension {
@ -284,7 +285,8 @@ export class VsCodeExtension {
if (
filepath.endsWith(".continuerc.json") ||
filepath.endsWith(".prompt")
filepath.endsWith(".prompt") ||
filepath.endsWith(SYSTEM_PROMPT_DOT_FILE)
) {
this.configHandler.reloadConfig();
} else if (
@ -296,14 +298,16 @@ export class VsCodeExtension {
} else {
// Reindex the file
this.core.invoke("index/forceReIndex", {
dirs: [filepath]
dirs: [filepath],
});
}
});
vscode.workspace.onDidDeleteFiles(async (event) => {
this.core.invoke("index/forceReIndex", {
dirs: event.files.map((file) => file.fsPath.split("/").slice(0, -1).join("/"))
dirs: event.files.map((file) =>
file.fsPath.split("/").slice(0, -1).join("/"),
),
});
});
@ -352,7 +356,8 @@ export class VsCodeExtension {
// Register a content provider for the readonly virtual documents
const documentContentProvider = new (class
implements vscode.TextDocumentContentProvider {
implements vscode.TextDocumentContentProvider
{
// emitter and its event
onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>();
onDidChange = this.onDidChangeEmitter.event;

View file

@ -6,7 +6,7 @@ import type { ILLM } from "core";
export class TabAutocompleteModel {
private _llm: ILLM | undefined;
private defaultTag = "starcoder2:3b";
private defaultTag = "qwen2.5-coder:1.5b";
private globalContext: GlobalContext = new GlobalContext();
constructor(private configHandler: ConfigHandler) {}

View file

@ -0,0 +1,13 @@
(
(class_declaration
(base_clause
(name) @superclass)
)
)
(
(class_declaration
(class_interface_clause
(name) @interface)
)
)

View file

@ -0,0 +1,12 @@
(
(function_declaration
(parameter_list
(parameter_declaration
type: (_) @param_type
)*
)
; Optional return type node before the block
([_] @return_type)?
(block)
)
)

View file

@ -1,10 +1,34 @@
; Pattern for capturing the return type
(
(function_declaration
(formal_parameters
(_
(type_annotation) @param_type
)
(function_declaration
(type_annotation) @return_type
)
)
; Pattern for parameters with direct type_identifier
(
(function_declaration
(formal_parameters
(_
(type_annotation
(type_identifier) @param_type
)
(type_annotation) @return_type
)
)
)
)
; Pattern for parameters with one level of nesting
(
(function_declaration
(formal_parameters
(_
(type_annotation
(_
(type_identifier) @param_type
)
)
)
)
)
)

View file

@ -0,0 +1,10 @@
(
(function_definition
parameters: (formal_parameters
(simple_parameter
type: (named_type) @param_type
)*
)
return_type: (named_type) @return_type
)
)

View file

@ -0,0 +1,10 @@
(
(method_declaration
(formal_parameters
(simple_parameter
type: (named_type) @param_type
)*
)
return_type: (named_type) @return_type
)
)

View file

@ -1,10 +1,34 @@
; Pattern for capturing the return type
(
(method_definition
(formal_parameters
(_
(type_annotation) @param_type
)
)
(type_annotation) @return_type
)
(method_definition
(type_annotation) @return_type
)
)
; Pattern for parameters with direct type_identifier
(
(method_definition
(formal_parameters
(_
(type_annotation
(type_identifier) @param_type
)
)
)
)
)
; Pattern for parameters with one level of nesting
(
(method_definition
(formal_parameters
(_
(type_annotation
(_
(type_identifier) @param_type
)
)
)
)
)
)

View file

@ -389,7 +389,7 @@ export const useFindWidget = (searchRef: RefObject<HTMLDivElement>) => {
e.stopPropagation();
previousMatch();
}}
className="h-4 w-4 focus:ring focus:ring-1"
className="h-4 w-4 focus:ring"
disabled={matches.length < 2 || active}
>
<ArrowUpIcon className="h-4 w-4" />
@ -401,7 +401,7 @@ export const useFindWidget = (searchRef: RefObject<HTMLDivElement>) => {
e.stopPropagation();
nextMatch();
}}
className="h-4 w-4 focus:ring focus:ring-1"
className="h-4 w-4 focus:ring"
disabled={matches.length < 2 || active}
>
<ArrowDownIcon className="h-4 w-4" />
@ -420,7 +420,7 @@ export const useFindWidget = (searchRef: RefObject<HTMLDivElement>) => {
e.stopPropagation();
setCaseSensitive((curr) => !curr);
}}
className="h-5 w-6 rounded-full border text-xs focus:outline-none focus:ring focus:ring-1"
className="h-5 w-6 rounded-full border text-xs focus:outline-none focus:ring"
>
Aa
</HeaderButtonWithToolTip>
@ -428,7 +428,7 @@ export const useFindWidget = (searchRef: RefObject<HTMLDivElement>) => {
<HeaderButton
inverted={false}
onClick={() => setOpen(false)}
className="focus:ring focus:ring-1"
className="focus:ring"
>
<XMarkIcon className="h-4 w-4" />
</HeaderButton>