knowledge/technology/applications/development/continue.md

211 lines
9.2 KiB
Markdown
Raw Normal View History

2024-04-02 19:50:29 +00:00
---
obj: application
website: https://continue.dev
rev: 2024-04-02
---
# continue
**Continue is an open-source autopilot for VS Code and JetBrains—the easiest way to code with any LLM**
2024-09-04 13:15:40 +00:00
![continue](./continue.avif)
2024-04-02 19:50:29 +00:00
Some examples of what you can achieve are:
- Use `cmd/ctrl + I` to generate boilerplate code from natural language
- Use our local tab-autocomplete to get inline suggestions and write boilerplate code quickly
- Highlight code, describe how to refactor it, and have changes streamed into your editor
- Ask high-level questions about your codebase, with Continue automatically finding relevant files
- Quickly generate unit tests for any function or class
- Ask a quick question to get immediate answers without leaving your editor
- Have your current changes reviewed for mistakes that the compiler can't catch
- Type `@` to reference dozens of different sources while communicating with the LLM
Continue lets you do all of this with any LLM, whether open-source, commercial, local, or remote. And we provide numerous points of configuration so that you can customize the extension to fit into your existing workflows.
You can run a model on your local computer using:
- [Ollama](../utilities/Ollama.md)
- LM Studio
- Llama.cpp
- KoboldCpp (OpenAI compatible server)
- llamafile ((OpenAI compatible server)
- LocalAI (OpenAI compatible server)
- Text generation web UI (OpenAI compatible server)
- FastChat (OpenAI compatible server)
- llama-cpp-python (OpenAI compatible server)
- TensorRT-LLM (OpenAI compatible server)
Once you have it running, you will need to configure it in the GUI or manually add it to your `config.json.
## Context Providers
Context Providers allow you to type `@` and see a dropdown of content that can all be fed to the LLM as context. Every context provider is a plugin, which means if you want to reference some source of information that you don't see here, you can request (or build!) a new context provider.
As an example, say you are working on solving a new [GitHub](GitHub.md) Issue. You type `@issue` and select the one you are working on. Continue can now see the issue title and contents. You also know that the issue is related to the files `readme.md` and `helloNested.py`, so you type `@readme` and `@hello` to find and select them. Now these 3 "Context Items" are displayed inline with the rest of your input.
### Built-in Context Providers
To use any of the built-in context providers, open `~/.continue/config.json` and add it to the `contextProviders` list.
#### Code
Type `@code` to reference specific functions or classes from throughout your project.
```json
{ "name": "code" }
```
#### [Git](../../dev/Git.md) Diff
Type `@diff` to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing.
```json
{ "name": "diff" }
```
#### Terminal
Type `@terminal` to reference the contents of your IDE's terminal.
```json
{ "name": "terminal" }
```
#### Documentation
Type `@docs` to index and retrieve snippets from any documentation site. You can add any site by selecting "Add Docs" in the dropdown, then entering the root [URL](../../internet/URL.md) of the documentation site and a title to remember it by. After the site has been indexed, you can type `@docs`, select your documentation from the dropdown, and Continue will use similarity search to automatically find important sections when answering your question.
```json
{ "name": "docs" }
```
#### Open Files
Type `@open` to reference the contents of all of your open files. Set `onlyPinned` to `true` to only reference pinned files.
```json
{ "name": "open", "params": { "onlyPinned": true } }
```
#### Codebase Retrieval
Type `@codebase` to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval [here](https://continue.dev/docs/walkthroughs/codebase-embeddings).
```json
{ "name": "codebase" }
```
#### Folders
Type `@folder` to use the same retrieval mechanism as `@codebase`, but only on a single folder.
```json
{ "name": "folder" }
```
#### Exact Search
Type `@search` to reference the results of codebase search, just like the results you would get from VS Code search. This context provider is powered by [ripgrep](../cli/ripgrep.md).
```json
{ "name": "search" }
```
#### File Tree
Type `@tree` to reference the structure of your current workspace. The LLM will be able to see the nested directory structure of your project.
```json
{ "name": "tree" }
```
#### GitHub Issues
Type `@issue` to reference the conversation in a [GitHub](GitHub.md) issue. Make sure to include your own [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) to avoid being rate-limited:
```json
{ "name": "issue", "params": { "repos": [ { "owner": "continuedev", "repo": "continue" } ], "githubToken": "ghp_xxx" }}
```
#### GitLab Merge Request
Type `@gitlab-mr` to reference an open MR for this branch on GitLab.
##### Configuration
You will need to create a [personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with the `read_api` scope. then add the following to your configuration:
```json
{ "name": "gitlab-mr", "params": { "token": "..." }}
```
##### Using Self-Hosted GitLab
You can specify the [domain](../../internet/Domain.md) to communicate with by setting the `domain` parameter in your configurtion. By default this is set to `gitlab.com`.
```json
{ "name": "gitlab-mr", "params": { "token": "...", "domain": "gitlab.example.com" }}
```
##### Filtering Comments
If you select some code to be edited, you can have the context provider filter out comments for other files. To enable this feature, set `filterComments` to `true`.
#### Jira Issues
Type `@jira` to reference the conversation in a Jira issue. Make sure to include your own [Atlassian API Token](https://id.atlassian.com/manage-profile/security/api-tokens).
```json
{ "name": "jira", "params": { "domain": "company.atlassian.net", "email": "someone@somewhere.com", "token ": "ATATT..." }}
```
#### Code Outline
Type `@outline` to reference the outline of all currently open files. The outline of a files consists of only the function and class definitions in the file. Supported file extensions are '.js', '.mjs', '.go', '.c', '.cc', '.cs', '.cpp', '.el', '.ex', '.elm', '.java', '.ml', '.php', '.ql', '.rb', '.rs', '.ts'
```json
{ "name": "outline" }
```
#### Code Highlights
Type `@highlights` to reference the 'highlights' from all currently open files. The highlights are computed using Paul Gauthier's so-called ['repomap'](https://aider.chat/docs/repomap.html) technique in [Aider Chat](https://github.com/paul-gauthier/aider). Supported file extensions are the same as for `@Outline` (behind the scenes, we use the corresponding tree-sitter grammars for language parsing).
```json
{ "name": "highlights" }
```
## Slash Commands
Slash commands are shortcuts that can be activated by typing `/` and selecting from the dropdown. For example, the built-in `/edit` slash command let you stream edits directly into your editor.
### Built-in Slash Commands
To use any of the built-in slash commands, open `~/.continue/config.json` and add it to the `slashCommands` list.
#### `/edit`
Select code with ctrl/cmd + M (VS Code) or ctrl/cmd + J (JetBrains), and then type `/edit`, followed by instructions for the edit. Continue will stream the changes into a side-by-side diff editor.
```json
{ "name": "edit", "description": "Edit highlighted code"}
```
#### `/comment`
Comment works just like `/edit`, except it will automatically prompt the LLM to comment the code.
```json
{ "name": "comment", "description": "Write comments for the highlighted code"}
```
#### `/share`
Type `/share` to generate a shareable [markdown](../../files/Markdown.md) transcript of your current chat history.
```json
{ "name": "share", "description": "Download and share this session"}
```
#### `/cmd`
Generate a [shell](../cli/Shell.md) command from natural language and (only in VS Code) automatically paste it into the terminal.
```json
{ "name": "cmd", "description": "Generate a shell command"}
```
#### `/commit`
Shows the LLM your current [git](../../dev/Git.md) diff and asks it to generate a commit message.
```json
{ "name": "commit", "description": "Generate a commit message for the current changes"}
```
#### `/issue`
Describe the issue you'd like to generate, and Continue will turn into a well-formatted title and body, then give you a link to the draft so you can submit. Make sure to set the [URL](../../internet/URL.md) of the repository you want to generate issues for.
```json
{ "name": "issue", "description": "Generate a link to a drafted GitHub issue", "params": { "repositoryUrl": "https://github.com/continuedev/continue" }}
```
#### `/so`
The StackOverflow slash command will automatically pull results from StackOverflow to answer your question, quoting links along with its answer.
```json
{ "name": "so", "description": "Reference StackOverflow to answer the question"}
```