This commit is contained in:
Test 2024-09-06 14:18:34 -07:00
parent 895085b52d
commit 9a11bca08e
9 changed files with 153 additions and 141 deletions

View file

@ -1,18 +1,36 @@
---
title: Context selection
description: Autocomplete \-context selection
keywords: [context]
description: Actions \-context selection
keywords: [context, slash, debug, quick fix, right click]
sidebar_position: 3
---
Autocomplete will automatically determine context based on the current cursor position. We use the following techniques to determine what to include in the prompt:
## Slash commands
### File prefix/suffix
Slash commands can be combined with additional instructions, including [context providers](../chat/context-selection.md) or [highlighted code](../chat/context-selection.md).
We will always include the code from your file prior to and after the cursor position.
For example, with the “/edit” slash command you should describe the edit that you want the LLM to perform.
### Type definitions from the LSP
Some slash commands will not acknowledge your input; for example, the “/share” slash command just creates a markdown copy of the current conversation, regardless of what else you may request it to do.
### Recent files
## Quick actions
We automatically consider recently opened or edited files and include snippets that are relevant to the current completion.
Quick actions are always displayed above a class or function and will edit that class or function, but nothing outside of it.
## Right click actions
The highlighted code you’ve selected will be included in your prompt alongside a pre-written set of instructions depending on the selected action. This is the only section of code that the model will attempt to edit.
## Debug action
The debug action selects the most recently run terminal command and its output and then injects the following prompt into the chat window. There is no additional, non-visible information sent to the language model.
```
I got the following error, can you please help explain how to fix it?
[ERROR_MESSAGE]
```
## Quick fixes
Similarly to the debug action, quick actions transparently inject a prompt into the chat window. When you select “Ask Continue”, the 3 lines above and below the error are sent to the chat followed by the question “How do I fix the following problem in the above code?: [ERROR_MESSAGE]”.

View file

@ -1,18 +1,12 @@
---
title: How it works
description: Autocomplete \-how it works
keywords: [how, autocomplete, context]
description: Actions \-how it works
keywords: [how, slash, commands, prompt, right click, quick fix, debug, action]
sidebar_position: 4
---
<!-- TODO: Add link for "compound AI system -->
While many actions are based on templated prompts and can be customized with .prompt files, there are a number that execute more complex code under the hood.
Continue’s autocomplete is a compound AI system that uses a combination of retrieval methods and response processing techniques. The system can be understood in roughly three parts.
Actions that generate inline diffs, like “/edit”, “/comment”, or right click actions, use the same prompt and response processing logic as [Edit](../edit/how-it-works.md).
## Timing
## Context
## Filtering
Continue's autocomplete analyzes your code context, including the current file, cursor position, and recent edits. It crafts a smart prompt using this information and relevant snippets from other files. The system then uses a language model to generate code suggestions, which can include multi-line completions or edits to existing code. These suggestions are refined for relevance and correctness, with successful completions cached for future use. Finally, the system displays the suggestions as ghost text for new additions or diff popups for modifications, allowing you to easily understand and incorporate the proposed changes.
To learn how other slash commands work, see the full reference [here](../reference/slash-commands).

View file

@ -1,20 +1,82 @@
---
title: How to use it
description: Autocomplete \- how to use it
keywords: [how]
description: Actions \- how to use it
keywords: [how, slash, commands, prompt, right click, quick fix, debug, action]
sidebar_position: 1
---
Tab autocomplete provides inline code suggestions as you type. To enable it, simply click the "Continue" button in the status bar at the bottom right of your IDE or ensure the "Enable Tab Autocomplete" option is checked in your IDE settings.
![action](/img/action.gif)
## See when ghost text appears
Actions are shortcuts for common use cases. For example, you might want to review code, write tests, or add a docstring.
Autocomplete will suggest code based on your recent changes for every keystroke or cursor movement. You'll see suggestions appear as ghost text when adding new code or when modifying existing code. Suggestions may not always appear if no changes are predicted.
## Slash commands
## Accept the suggestions
The most common way to invoke an action is with a slash command. These are shortcuts that can be activated by typing '/' and selecting from the dropdown. For example, the built-in '/edit' slash command lets you stream edits directly into your editor.
Accept a full suggestion by pressing Tab, or reject it with Esc. Use Ctrl/CMD + → to accept part of a suggestion word-by-word, allowing for more granular control. To reject a suggestion, simply continue typing or press Escape.
![slash-commands](/img/slash-commands.png)
:::tip
Getting only ever single-line suggestions? To ensure multi-line completions, set "multilineCompletions": "always" in tabAutocompleteOptions. If you're still seeing only single-line completions, try temporarily moving text below your cursor out of your active file or switching to a larger model.
A few of the most useful slash commands are available by default, like “/edit”, “/comment”, and “/share”, but Continue has a large built-in library of other options. To enable these, learn more [here](TODO).
## Prompt files
It is also possible to write your own slash command by defining a “.prompt file.” Prompt files can be as simple as a text file, but also include templating so that you can refer to files, URLs, highlighted code, and more.
The full .prompt file reference can be found [here](TODO).
:::tip[Prompt library]
To assist you in getting started, [we've curated a small library of `.prompt` files](https://github.com/continuedev/prompt-file-examples). We encourage community contributions to this repository, so please consider opening up a pull request with your own prompts!
:::
Below is a quick example of setting up a prompt file to write unit tests using Jest.
1. Create a folder called `.prompts/` at the top level of your workspace.
2. Add a file called `test.prompt` to this folder. The name of this file will be the name of the slash command you will use to generate your prompt.
3. Write the following contents to `test.prompt` and save.
```
{{{ input }}}
Write unit tests for the above selected code, following each of these instructions:
- Use `jest`
- Properly set up and tear down
- Include important edge cases
- The tests should be complete and sophisticated
- Give the tests just as chat output, don't edit any file
- Don't explain how to set up `jest`
```
Now to use this prompt, you can highlight code and use `cmd/ctrl+L` to select it in the Continue sidebar.
Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file.
## Other triggers for actions (VS Code)
:::info
Currently all of these are only available in VS Code
:::
To make common use cases even more accessible, we provide a handful of other ways to invoke actions.
### Quick actions
Quick Actions are displayed as buttons above top-level classes and functions in your source code, letting you invoke actions with one click. They can also be customized with .prompt files to perform custom actions.
![quick-actions](/img/quick-actions.png)
By default, quick actions are disabled, but can be enabled with the “Continue: Enable Quick Actions” in VS Code settings.
### Right click actions
Right click actions let you highlight a desired region of code, right click, and then select an action from the dropdown menu.
![context-menu](/img/context-menu.png)
### Debug action
The debug action is a special built-in keyboard shortcut in the VS Code extension. Use `cmd/ctrl+shift+R` to instantly copy the contents of the current terminal into the chat sidebar and get debugging advice.
### Quick fixes
Whenever you see red/yellow underlines in your code indicating errors, you can place your cursor nearby and VS Code will display a lightbulb icon. Either clicking the lightbulb or using the keyboard shortcut `cmd/ctrl+.` will show a dropdown menu of quick fixes. One of these will be the “Ask Continue” action. Either click or use `cmd/ctrl+.` again and Continue will attempt to help solve the problem.
![ask-continue](/img/ask-continue.png)

View file

@ -7,11 +7,11 @@ sidebar_position: 5
Experiment with these settings to find the perfect balance between suggestion quality and system performance for your specific needs and hardware capabilities:
```config.json
```json title="config.json"
"tabAutocompleteOptions": {
"useCopyBuffer": false,
"maxPromptTokens": 400,
"prefixPercentage": 0.5
"prefixPercentage": 0.5,
"multilineCompletions": "always"
}
```

View file

@ -1,36 +1,18 @@
---
title: Context selection
description: Actions \-context selection
keywords: [context, slash, debug, quick fix, right click]
description: Autocomplete \-context selection
keywords: [context]
sidebar_position: 3
---
## Slash commands
Autocomplete will automatically determine context based on the current cursor position. We use the following techniques to determine what to include in the prompt:
Slash commands can be combined with additional instructions, including [context providers](../chat/context-selection.md) or [highlighted code](../chat/context-selection.md).
### File prefix/suffix
For example, with the “/edit” slash command you should describe the edit that you want the LLM to perform.
We will always include the code from your file prior to and after the cursor position.
Some slash commands will not acknowledge your input; for example, the “/share” slash command just creates a markdown copy of the current conversation, regardless of what else you may request it to do.
### Type definitions from the LSP
## Quick actions
### Recent files
Quick actions are always displayed above a class or function and will edit that class or function, but nothing outside of it.
## Right click actions
The highlighted code you’ve selected will be included in your prompt alongside a pre-written set of instructions depending on the selected action. This is the only section of code that the model will attempt to edit.
## Debug action
The debug action selects the most recently run terminal command and its output and then injects the following prompt into the chat window. There is no additional, non-visible information sent to the language model.
```
I got the following error, can you please help explain how to fix it?
[ERROR_MESSAGE]
```
## Quick fixes
Similarly to the debug action, quick actions transparently inject a prompt into the chat window. When you select “Ask Continue”, the 3 lines above and below the error are sent to the chat followed by the question “How do I fix the following problem in the above code?: [ERROR_MESSAGE]”.
We automatically consider recently opened or edited files and include snippets that are relevant to the current completion.

View file

@ -1,16 +1,18 @@
---
title: How it works
description: How Chat works
keywords: [how, chat, works]
description: Autocomplete \-how it works
keywords: [how, autocomplete, context]
sidebar_position: 4
---
Using any selected code sections, all context that you have selected with @, and your input instructions, we prompt the model to provide a response in the sidebar. If you are asking a follow-up, then the all earlier session context is also included. No other additional context is provided to the model.
<!-- TODO: Add link for "Compound AI system -->
The model response is then streamed directly back to the sidebar. Each code section included in the response will be placed into its own code block, which gives you buttons to either “Apply to current file”, “Insert at cursor”, or “Copy” for each section.
Continue’s autocomplete is a compound AI system that uses a combination of retrieval methods and response processing techniques. The system can be understood in roughly three parts.
When you press cmd+L at the end of a session, all context is cleared and a new session is started, so that you can begin a new task. If you would like to view the exact prompt that is sent to the model during Chat, you can [view this in the prompt logs](../reference/).
## Timing
:::info
TODO: You can learn about how @codebase and how @docs work here and here
:::
## Context
## Filtering
Continue's autocomplete analyzes your code context, including the current file, cursor position, and recent edits. It crafts a smart prompt using this information and relevant snippets from other files. The system then uses a language model to generate code suggestions, which can include multi-line completions or edits to existing code. These suggestions are refined for relevance and correctness, with successful completions cached for future use. Finally, the system displays the suggestions as ghost text for new additions or diff popups for modifications, allowing you to easily understand and incorporate the proposed changes.

View file

@ -1,80 +1,32 @@
---
title: How to use it
description: Actions \- how to use it
keywords: [how, slash, commands, prompt, right click, quick fix, debug, action]
description: Autocomplete \- how to use it
keywords: [how]
sidebar_position: 1
---
Actions are shortcuts for common use cases. For example, you might want to review code, write tests, or add a docstring.
![autocomplete](/img/autocomplete.gif)
## Slash commands
Tab autocomplete provides inline code suggestions as you type. To enable it, simply click the "Continue" button in the status bar at the bottom right of your IDE or ensure the "Enable Tab Autocomplete" option is checked in your IDE settings.
The most common way to invoke an action is with a slash command. These are shortcuts that can be activated by typing '/' and selecting from the dropdown. For example, the built-in '/edit' slash command lets you stream edits directly into your editor.
## See when ghost text appears
![slash-commands](/img/slash-commands.png)
Autocomplete will suggest code based on your recent changes for every keystroke or cursor movement. You'll see suggestions appear as ghost text when adding new code or when modifying existing code. Suggestions may not always appear if no changes are predicted.
A few of the most useful slash commands are available by default, like “/edit”, “/comment”, and “/share”, but Continue has a large built-in library of other options. To enable these, learn more [here](TODO).
## Accept the suggestions
## Prompt files
Accept a full suggestion by pressing Tab, or reject it with Esc. Use Ctrl/CMD + → to accept part of a suggestion word-by-word, allowing for more granular control. To reject a suggestion, simply continue typing or press Escape.
It is also possible to write your own slash command by defining a “.prompt file.” Prompt files can be as simple as a text file, but also include templating so that you can refer to files, URLs, highlighted code, and more.
:::tip
Only getting single-line suggestions?
The full .prompt file reference can be found [here](TODO).
To ensure multi-line completions, update your `tabAutocompleteOptions` with the following:
:::tip[Prompt library]
To assist you in getting started, [we've curated a small library of `.prompt` files](https://github.com/continuedev/prompt-file-examples). We encourage community contributions to this repository, so please consider opening up a pull request with your own prompts!
:::
Below is a quick example of setting up a prompt file to write unit tests using Jest.
1. Create a folder called `.prompts/` at the top level of your workspace.
2. Add a file called `test.prompt` to this folder. The name of this file will be the name of the slash command you will use to generate your prompt.
3. Write the following contents to `test.prompt` and save.
```
{{{ input }}}
Write unit tests for the above selected code, following each of these instructions:
- Use `jest`
- Properly set up and tear down
- Include important edge cases
- The tests should be complete and sophisticated
- Give the tests just as chat output, don't edit any file
- Don't explain how to set up `jest`
```json title="config.json"
"tabAutocompleteOptions": {
"multilineCompletions": "always"
},
```
Now to use this prompt, you can highlight code and use `cmd/ctrl + L` to select it in the Continue sidebar.
Then, type "/" to see the list of slash commands and choose the one called "test". Press enter and the LLM will respond given the instructions from your prompt file.
## Other triggers for actions (VS Code)
:::info
Currently all of these are only available in VS Code
If you're still seeing only single-line completions, try temporarily moving text below your cursor out of your active file or switching to a larger model.
:::
To make common use cases even more accessible, we provide a handful of other ways to invoke actions.
### Quick actions
Quick Actions are displayed as buttons above top-level classes and functions in your source code, letting you invoke actions with one click. They can also be customized with .prompt files to perform custom actions.
![quick-actions](/img/quick-actions.png)
By default, quick actions are disabled, but can be enabled with the “Continue: Enable Quick Actions” in VS Code settings.
### Right click actions
Right click actions let you highlight a desired region of code, right click, and then select an action from the dropdown menu.
![context-menu](/img/context-menu.png)
### Debug action
The debug action is a special built-in keyboard shortcut in the VS Code extension. Use `cmd/ctrl + shift + R` to instantly copy the contents of the current terminal into the chat sidebar and get debugging advice.
### Quick fixes
Whenever you see red/yellow underlines in your code indicating errors, you can place your cursor nearby and VS Code will display a lightbulb icon. Either clicking the lightbulb or using the keyboard shortcut `cmd/ctrl + .` will show a dropdown menu of quick fixes. One of these will be the “Ask Continue” action. Either click or use `cmd/ctrl + .` again and Continue will attempt to help solve the problem.
![ask-continue](/img/ask-continue.png)

View file

@ -9,14 +9,14 @@ sidebar_position: 2
For the best autocomplete experience, we recommend using Codestral through the [Mistral API](https://console.mistral.ai/). This model offers high-quality completions with an excellent understanding of code context:
```title="config.json"
```json title="config.json""
{
"tabAutocompleteModel": {
"title": "Codestral",
"provider": "mistral",
"model": "codestral-latest",
"apiKey": "YOUR_API_KEY"
}
"tabAutocompleteModel": {
"title": "Codestral",
"provider": "mistral",
"model": "codestral-latest",
"apiKey": "YOUR_API_KEY"
}
}
```
@ -24,13 +24,13 @@ For the best autocomplete experience, we recommend using Codestral through the [
For those preferring local execution or self-hosting, StarCoder2-3b offers a good balance of performance and quality for most users:
```title="config.json"
```json title="config.json""
{
"tabAutocompleteModel": {
"title": "StarCoder2-3b",
"model": "starcoder2:3b",
"provider": "ollama",
}
"tabAutocompleteModel": {
"title": "StarCoder2-3b",
"model": "starcoder2:3b",
"provider": "ollama"
}
}
```

View file

@ -5,6 +5,8 @@ keywords: [how, use, chat]
sidebar_position: 1
---
![chat](/img/chat.gif)
Chat makes it easy to ask for help from an LLM without needing to leave the IDE. You send it a task, including any relevant information, and it replies with the text / code most likely to complete the task. If it does not give you want you want, then you can send follow up messages to clarify and adjust its approach until the task is completed.
Chat is best used to understand and iterate on code or as a replacement for search engine queries.