Merge branch 'main' into nate/platform

This commit is contained in:
Nate 2025-01-14 11:46:23 -08:00
commit 8a204a4bf7
12 changed files with 1590 additions and 1803 deletions

View file

@ -118,6 +118,7 @@
"@types/jest": "^29.5.12",
"@types/jquery": "^3.5.29",
"@types/jsdom": "^21.1.6",
"@types/json-schema": "^7.0.15",
"@types/mozilla-readability": "^0.2.1",
"@types/mustache": "^4.2.5",
"@types/node-fetch": "^2.6.11",

View file

@ -33,7 +33,6 @@ import {
} from "../commands/index.js";
import { AllRerankers } from "../context/allRerankers";
import { MCPManagerSingleton } from "../context/mcp";
import CodebaseContextProvider from "../context/providers/CodebaseContextProvider";
import ContinueProxyContextProvider from "../context/providers/ContinueProxyContextProvider";
import CustomContextProviderClass from "../context/providers/CustomContextProvider";
import FileContextProvider from "../context/providers/FileContextProvider";
@ -72,7 +71,7 @@ import {
defaultSlashCommandsVscode,
} from "./default";
import { getSystemPromptDotFile } from "./getSystemPromptDotFile";
import { isSupportedLanceDbCpuTarget } from "./util";
// import { isSupportedLanceDbCpuTarget } from "./util";
import { validateConfig } from "./validation.js";
function resolveSerializedConfig(filepath: string): SerializedContinueConfig {
@ -172,9 +171,10 @@ function loadSerializedConfig(
? [...defaultSlashCommandsVscode]
: [...defaultSlashCommandsJetBrains];
if (!isSupportedLanceDbCpuTarget(ide)) {
config.disableIndexing = true;
}
// Temporarily disabling this check until we can verify the commands are accuarate
// if (!isSupportedLanceDbCpuTarget(ide)) {
// config.disableIndexing = true;
// }
return { config, errors, configLoadInterrupted: false };
}
@ -231,6 +231,13 @@ export function isContextProviderWithParams(
return (contextProvider as ContextProviderWithParams).name !== undefined;
}
const getCodebaseProvider = async (params: any) => {
const { default: CodebaseContextProvider } = await import(
"../context/providers/CodebaseContextProvider"
);
return new CodebaseContextProvider(params);
};
/** Only difference between intermediate and final configs is the `models` array */
async function intermediateToFinalConfig(
config: Config,
@ -390,9 +397,14 @@ async function intermediateToFinalConfig(
| ContextProviderWithParams
| undefined
)?.params || {};
const DEFAULT_CONTEXT_PROVIDERS = [
new FileContextProvider({}),
new CodebaseContextProvider(codebaseContextParams),
// Add codebase provider if indexing is enabled
...(!config.disableIndexing
? [await getCodebaseProvider(codebaseContextParams)]
: []),
// Add prompt files provider if enabled
...(loadPromptFiles ? [new PromptFilesContextProvider({})] : []),
];

View file

@ -251,16 +251,6 @@ Example
]
```
### `analytics`
Configuration for analytics tracking.
**Properties:**
- `provider`: Analytics provider (`"posthog"` or `"logstash"`).
- `url`: URL for analytics data.
- `clientKey`: Client key for analytics.
### `slashCommands`
Custom commands initiated by typing "/" in the sidebar. Commands include predefined functionality or may be user-defined.
@ -420,6 +410,7 @@ Several experimental config parameters are available, as described below:
- `fix`: Prompt for fixing code.
- `optimize`: Prompt for optimizing code.
- `useChromiumForDocsCrawling`: Use Chromium to crawl docs locally. Useful if the default Cheerio crawler fails on sites that require JavaScript rendering. Downloads and installs Chromium to `~/.continue/.utils`..
- `modelContextProtocolServers`: See [Model Context Protocol](/customize/context-providers#model-context-protocol)
Example
@ -441,7 +432,16 @@ Example
"fixGrammar": "Fix grammar in the above but allow for typos."
},
"readResponseTTS": false,
"useChromiumForDocsCrawling": true
"useChromiumForDocsCrawling": true,
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
}
}
]
}
}
```

265
docs/docs/yaml-migration.md Normal file
View file

@ -0,0 +1,265 @@
---
title: Config Migration to YAML
description: Reference for migrating from JSON to YAML Continue configuration.
keywords: [config, yaml, configuration, customize, customization, migration]
---
# Migrating Config to YAML
Continue's YAML configuration format provides more readable, maintainable, consistent configuration files, as well as new configuration options and removal of some old configuration options. YAML is the preferred format and will be used to integrate with future Continue products. Below is a brief guide for migration from `config.json` to `config.yaml`.
See also
- [Intro to YAML](https://yaml.org/)
- [JSON Continue Config Reference](/reference)
- [YAML Continue Config Reference](/yaml-reference)
### 1. Create YAML file
Create a `config.yaml` file in your Continue Global Directory (`~/.continue` on Mac, `%USERPROFILE%\.continue`) alongside your current `config.json` file. If a `config.yaml` file is present, it will be loaded instead of `config.json`.
Give your configuration a `name` and a `version`:
```yaml title="config.yaml"
name: my-configuration
version: 0.0.1
```
### 2. Map Models
Add all model configurations in `config.json`, including models in `models`, `tabAutocompleteModel`, `embeddingsProvider`, and `reranker`, to the `models` section of your new YAML config file. A new `roles` YAML field specifies which roles a model can be used for, with possible values `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`.
- `models` in config should have `roles: chat`
- `tabAutocompleteModel`(s) in config should have `roles: autocomplete`
- `embeddingsProvider` in config should have `roles: embed`
- `reranker` in config should have `roles: rerank`
- `experimental.modelRoles` is replaced by simply adding roles to the model
- `inlineEdit` -> e.g. `roles: [chat, edit]`
- `applyCodeBlock` -> e.g. `roles: [chat, apply]`
Model-level `requestOptions` remain, with minor changes. See [YAML Continue Config Reference](/yaml-reference#requestoptions)
Model-level `completionOptions` are replaced by `defaultCompletionOptions`, with minor changes. See [YAML Continue Config Reference](/yaml-reference#completionoptions)
<!-- TODO - API KEY -> apiKeySecret? -->
<!-- TODO - ollama autodetect supported? -->
**Before**
```json title="config.json"
{
"models": [
{
"title": "GPT-4",
"provider": "openai",
"model": "gpt-4",
"apiKey": "YOUR_API_KEY",
"completionOptions": {
"temperature": 0.5,
"maxTokens": 2000
}
},
{
"title": "Ollama",
"provider": "ollama",
"model": "AUTODETECT"
},
{
"title": "My Open AI Compatible Model",
"provider": "openai",
"apiBase": "http://3.3.3.3/v1",
"model": "my-openai-compatible-model",
"requestOptions": {
"headers": { "X-Auth-Token": "<API_KEY>" }
}
}
],
"tabAutocompleteModel": {
"title": "My Starcoder",
"provider": "ollama",
"model": "starcoder2:3b"
},
"embeddingsProvider": {
"provider": "openai",
"model": "text-embedding-ada-002",
"apiKey": "<API_KEY>",
"maxChunkSize": 256,
"maxBatchSize": 5
},
"reranker": {
"name": "voyage",
"params": {
"model": "rerank-2",
"apiKey": "<VOYAGE_API_KEY>"
}
}
}
```
**After**
```yaml title="config.yaml"
models:
- name: GPT-4
provider: openai
model: gpt-4
defaultCompletionOptions:
temperature: 0.5
maxTokens: 2000'
roles: [chat, edit]
apiKey: <API_KEY>
- name: My Voyage Reranker
provider: voyage
roles: rerank
apiKey: <API_KEY>
- name: My Starcoder
provider: ollama
model: starcoder2:3b
roles: autocomplete
- name: My Ada Embedder
provider: openai
roles: embed
apiKey: <API_KEY>
- name: Ollama Autodetect
provider: ollama
model: AUTODETECT
- name: My Open AI Compatible Model - Apply
provider: openai
apiBase: http://3.3.3.3/v1
model: my-openai-compatible-model
requestOptions:
headers:
X-Auth-Token: <API_KEY>
roles: [chat, apply]
```
Note that the `repoMapFileSelection` experimental model role has been deprecated.
### 3. Map Context Providers
The JSON `contextProviders` and `docs` fields are replaced by the YAML `context` array.
- JSON `name` maps to `uses`
- JSON `params` map to `with`
- Use multiple `docs` entries rather than the array of docs in the JSON format
<!-- TODO is this docs not correct ?^ -->
**Before**
```json title="config.json"
{
"contextProviders": [
{
"name": "docs",
"params": {
"startUrl": "https://docs.continue.dev/intro"
}
},
{
"name": "codebase",
"params": {
"nRetrieve": 30,
"nFinal": 3
}
},
{
"name": "diff",
"params": {}
}
],
"docs": [
{
"startUrl": "https://docs.nestjs.com/",
"title": "nest.js"
},
{
"startUrl": "https://mysite.com/docs/",
"title": "My site"
}
]
}
```
**After**
```yaml title="config.yaml"
context:
- uses: docs
with:
startUrl: https://docs.nestjs.com/
title: nest.js
- uses: docs
with:
startUrl: https://mysite.com/docs/
title: My Site
- uses: codebase
with:
nRetrieve: 30
nFinal: 3
- uses: diff
```
## Map MCP Servers
<!-- TODO this is definitely wrong -->
**Properties:**
- `name` (**required**): The name of the MCP server.
- `command` (**required**): The command used to start the server.
- `args`: An optional array of arguments for the command.
- `env`: An optional map of environment variables for the server process.
**Before**
```json title="config.json"
{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"]
}
}
]
}
}
```
**After**
```yaml title="config.yaml"
mcpServers:
- name: My MCP Server
command: uvx
args:
- mcp-server-sqlite
- --db-path
- /Users/NAME/test.db
```
---
## Deprecated configuration options
The following top-level fields from `config.json` have been deprecated
- Slash commands (JSON `slashCommands`)
- top-level `requestOptions`
- top-level `completionOptions`
- `tabAutocompleteOptions`
- `analytics`
- `customCommands`
- `disableSessionTitles`
- `experimental`
- `allowAnonymousTelemetry` (moved to user/IDE level)
- `ui` (moved to user/IDE level)
- `userToken`
- `systemMessage`
- `disableIndexing` (moved to user/IDE level)
## New Configuration options
The YAML configuration format offers new configuration options not available in the JSON format. See the [YAML Config Reference](/yaml-reference) for more information.

294
docs/docs/yaml-reference.md Normal file
View file

@ -0,0 +1,294 @@
---
title: Config YAML Reference
description: Reference for the Continue configuration YAML file
keywords: [config, yaml, configuration, customize, customization]
---
# Config YAML Reference
<!-- TODO - data and packages sections -->
Continue can be configured using a YAML file `config.yaml` which for local configuration can be placed in your global `.continue` folder (`~/.continue` on Mac, `%USERPROFILE%\.continue`)
Below are details for each property that can be set in `config.yaml`.
:::info
Config YAML does not work alongside `config.json` - it replaces it. View the **[Migration Guide](/yaml-migration)**. `config.yaml` currently only works in VS Code pre-release.
:::
**All properties at all levels are optional unless explicitly marked as required.**
## Properties
The top-level properties in the `config.yaml` configuration file are:
- [`name`](#name) (**required**)
<!-- - [`packages`](#packages) -->
- [`version`](#version) (**required**)
- [`models`](#models)
- [`context`](#context)
- [`rules`](#rules)
- [`docs`](#docs)
<!-- - [`data`](#data) -->
<!-- - [`tools`](#tools) -->
- [`mcpServers`](#mcpservers)
---
### `name`
The `name` property specifies the name of your project or configuration.
```yaml title="config.yaml"
name: MyProject
```
### `version`
The `version` property specifies the version of your project or configuration.
---
### `models`
The `models` section defines the language models used in your configuration. Models are used for functionalities such as chat, editing, and summarizing.
**Properties:**
- `name` (**required**): A unique name to identify the model within your configuration.
- `provider` (**required**): The provider of the model (e.g., `openai`, `ollama`).
- `model` (**required**): The specific model name (e.g., `gpt-4`, `starcoder`).
- `roles`: An array specifying the roles this model can fulfill, such as `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`.
- `defaultCompletionOptions`: Default completion options for model settings.
**Properties:**
- `contextLength`: Maximum context length of the model, typically in tokens.
- `maxTokens`: Maximum number of tokens to generate in a completion.
- `temperature`: Controls the randomness of the completion. Values range from `0.0` (deterministic) to `1.0` (random).
- `topP`: The cumulative probability for nucleus sampling.
- `topK`: Maximum number of tokens considered at each step.
- `stop`: An array of stop tokens that will terminate the completion.
- `n`: Number of completions to generate.
- `requestOptions`: HTTP request options specific to the model.
**Properties:**
- `timeout`: Timeout for each request to the language model.
- `verifySsl`: Whether to verify SSL certificates for requests.
- `caBundlePath`: Path to a custom CA bundle for HTTP requests.
- `proxy`: Proxy URL for HTTP requests.
- `headers`: Custom headers for HTTP requests.
- `extraBodyProperties`: Additional properties to merge with the HTTP request body.
- `noProxy`: List of hostnames that should bypass the specified proxy.
- `clientCertificate`: Client certificate for HTTP requests.
- `cert`: Path to the client certificate file.
- `key`: Path to the client certificate key file.
- `passphrase`: Optional passphrase for the client certificate key file.
#### Example:
```yaml title="config.yaml"
models:
- name: GPT-4o
provider: openai
model: gpt-4o
roles:
- chat
- edit
- apply
defaultCompletionOptions:
temperature: 0.7
maxTokens: 1500
- name: Codestral
provider: mistral
model: codestral-latest
roles:
- autocomplete
```
---
### `context`
The `context` section defines context providers, which supply additional information or context to the language models. Each context provider can be configured with specific parameters.
More information about usage/params for each context provider can be found [here](/customize/context-providers)
**Properties:**
- `uses` (**required**): The identifier or name of the context provider (e.g., `code`, `docs`, `web`).
- `with`: Optional parameters to configure the context provider's behavior.
**Example:**
```yaml title="config.yaml"
context:
- uses: files
- uses: code
- uses: codebase
with:
nFinal: 10
- uses: docs
- uses: diff
- uses: folder
- uses: terminal
```
---
### `rules`
List of rules that the LLM should follow. These are inserted into the system message for all chat requests.
Example
```yaml title="config.yaml"
rules:
- Always annotate Python functions with their parameter and return types
- Always write Google style docstrings for functions and classes
```
---
### `docs`
List of documentation sites to index.
**Properties:**
- `name` (**required**): Name of the documentation site, displayed in dropdowns, etc.
- `startUrl` (**required**): Start page for crawling - usually root or intro page for docs
- `rootUrl`: Crawler will only index docs within this domain - pages that contain this URL
- `favicon`: URL for site favicon (default is `/favicon.ico` from `startUrl`).
Example
```yaml title="config.yaml"
docs:
- name: Continue
startUrl: https://docs.continue.dev/intro
rootUrl: https://docs.continue.dev
favicon: https://docs.continue.dev/favicon.ico
```
---
### `tools`
<!-- TODO how does this actually work -->
The `tools` section specifies external tools or APIs that can be used within your configuration.
**Properties:**
- `url` (**required**): The URL of the tool's API or endpoint.
- `apiKey`: An optional API key required by the tool.
**Example:**
```yaml title="config.yaml"
tools:
- url: https://api.exampletool.com/tool1
apiKey: YOUR_API_KEY
```
---
### `mcpServers`
<!-- TODO is this correct? -->
The [Model Context Protocol](https://modelcontextprotocol.io/introduction) is a standard proposed by Anthropic to unify prompts, context, and tool use. Continue supports any MCP server with the MCP context provider.
**Properties:**
- `name` (**required**): The name of the MCP server.
- `command` (**required**): The command used to start the server.
- `args`: An optional array of arguments for the command.
- `env`: An optional map of environment variables for the server process.
**Example:**
```yaml title="config.yaml"
mcpServers:
- name: My MCP Server
command: uvx
args:
- mcp-server-sqlite
- --db-path
- /Users/NAME/test.db
```
<!-- ### `data`
The `data` section specifies data providers used in your configuration. Data providers supply data or resources for use in various operations.
**Properties:**
- `provider` (**required**): The name of the data provider.
**Example:**
```yaml title="config.yaml"
data:
- provider: embeddings
```
--- -->
---
## Complete YAML Config Example
Putting it all together, here's a complete example of a `config.yaml` configuration file:
```yaml title="config.yaml"
name: MyProject
models:
- name: GPT-4
provider: openai
model: gpt-4
roles:
- chat
- edit
defaultCompletionOptions:
temperature: 0.5
maxTokens: 2000
requestOptions:
headers:
Authorization: Bearer YOUR_OPENAI_API_KEY
- name: Ollama Starcoder
provider: ollama
model: starcoder
roles:
- autocomplete
defaultCompletionOptions:
temperature: 0.3
stop:
- "\n"
context:
- uses: diff
- uses: docs
with:
startUrl: https://docs.example.com/introduction
rootUrl: https://docs.example.com
maxDepth: 3
tools:
- url: https://api.exampletool.com
apiKey: YOUR_TOOL_API_KEY
mcpServers:
- name: DevServer
command: npm
args:
- run
- dev
env:
PORT: "3000"
```

View file

@ -13,7 +13,6 @@ const config = {
experimental_faster: true,
},
title: "Continue",
tagline:
"the open-source library for accelerating software development with language models",

2702
docs/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -16,10 +16,10 @@
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@docusaurus/core": "^3.6.3",
"@docusaurus/faster": "^3.6.3",
"@docusaurus/plugin-client-redirects": "^3.6.3",
"@docusaurus/preset-classic": "^3.6.3",
"@docusaurus/core": "^3.7.0",
"@docusaurus/faster": "^3.7.0",
"@docusaurus/plugin-client-redirects": "^3.7.0",
"@docusaurus/preset-classic": "^3.7.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.1.0",
"prism-react-renderer": "^2.3.1",
@ -27,7 +27,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.6.3",
"@docusaurus/module-type-aliases": "^3.7.0",
"nodemon": "^3.1.4"
},
"browserslist": {

View file

@ -138,6 +138,16 @@ const sidebars = {
label: "Reference",
href: "/reference",
},
// {
// type: "link",
// label: "YAML Reference",
// href: "/yaml-reference",
// },
// {
// type: "link",
// label: "YAML Migration",
// href: "/yaml-migration",
// },
],
};

View file

@ -1,31 +1,31 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Extension" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="env">
<map>
<entry key="GUI_URL" value="http://localhost:5173/jetbrains_index.html" />
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.1" />
<entry key="USE_TCP" value="true" />
</map>
</option>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value="runIde" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2" />
</configuration>
<configuration default="false" name="Run Extension" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="env">
<map>
<entry key="GUI_URL" value="http://localhost:5173/jetbrains_index.html"/>
<entry key="ORG_GRADLE_PROJECT_platformVersion" value="2024.1"/>
<entry key="USE_TCP" value="true"/>
</map>
</option>
<option name="executionName"/>
<option name="externalProjectPath" value="$PROJECT_DIR$/extensions/intellij"/>
<option name="externalSystemIdString" value="GRADLE"/>
<option name="scriptParameters" value=""/>
<option name="taskDescriptions">
<list/>
</option>
<option name="taskNames">
<list>
<option value="runIde"/>
</list>
</option>
<option name="vmOptions"/>
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>false</RunAsTest>
<method v="2"/>
</configuration>
</component>

View file

@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
pluginName=continue-intellij-extension
pluginRepositoryUrl=https://github.com/continuedev/continue
# SemVer format -> https://semver.org
pluginVersion=0.0.84
pluginVersion=0.0.85
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild=223
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension

View file

@ -179,8 +179,8 @@ class ContinuePluginSelectionListener(
val lineStartOffset = document.getLineStartOffset(lineNumber)
val lineEndOffset = document.getLineEndOffset(lineNumber)
val lineText = document.getText(TextRange(lineStartOffset, lineEndOffset)).trimEnd()
val endOfLinePos = LogicalPosition(lineNumber, lineText.length)
return editor.logicalPositionToXY(endOfLinePos).x
val visualPosition = editor.offsetToVisualPosition(lineStartOffset + lineText.length)
return editor.visualPositionToXY(visualPosition).x
}
val offset = 40