This commit is contained in:
Nate 2024-09-06 18:16:22 -07:00
parent 9a11bca08e
commit a538eca05d
5 changed files with 36 additions and 31 deletions

View file

@ -5,7 +5,7 @@ keywords: [configuration, advanced]
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:
Continue offers a handful of parameters in [`config.json`](../reference/config-json.md) that can be tuned to find the perfect balance between suggestion quality and system performance for your specific needs and hardware capabilities:
```json title="config.json"
"tabAutocompleteOptions": {
@ -21,4 +21,4 @@ Experiment with these settings to find the perfect balance between suggestion qu
- `prefixPercentage`: Defines the proportion of the prompt dedicated to the code before the cursor.
- `multilineCompletions`: Controls whether suggestions can span multiple lines ("always", "never", or "auto").
For a comprehensive guide on all configuration options and their impacts, refer to our (detailed configuration documentation).
For a comprehensive guide on all configuration options and their impacts, see the [full reference](../reference/config-json.md).

View file

@ -1,7 +1,7 @@
---
title: Context selection
description: Autocomplete \-context selection
keywords: [context]
keywords: [context, autocomplete, lsp, recent]
sidebar_position: 3
---
@ -11,7 +11,13 @@ Autocomplete will automatically determine context based on the current cursor po
We will always include the code from your file prior to and after the cursor position.
### Type definitions from the LSP
### Definitions from the Language Server Protocol
Similar to how you can use `cmd/ctrl+click` in your editor, we use the same tool (the LSP) to power "go to definition". For example, if you are typing out a function call, we will include the function definition. Or, if you are writing code inside of a method, we will include the type definitions for any parameters or the return type.
### Imported files
Because there are often many imports, we can't include all of them. Instead, we look for symbols around your cursor that have matching imports and use that as context.
### Recent files

View file

@ -5,14 +5,25 @@ keywords: [how, autocomplete, context]
sidebar_position: 4
---
<!-- TODO: Add link for "Compound AI system -->
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.
Continue’s autocomplete is a [compound AI system](https://bair.berkeley.edu/blog/2024/02/18/compound-ai-systems/) that uses a combination of retrieval methods and response processing techniques. The system can be understood in roughly three parts.
## Timing
In order to display suggestions quickly, without sending too many requests, we do the following:
- Debouncing: If you are typing quickly, we won't make a request on each keystroke. Instead, we wait until you have finished.
- Caching: If your cursor is in a position that we've already generated a completion for, this completion is reused. For example, if you backspace, we'll be able to immediately show the suggestion you saw before.
## Context
As explained on the [context selection](context-selection.md) page, Continue uses a number of retrieval methods to find relevant snippets from your codebase to include in the prompt.
## 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.
Language models aren't perfect, but can be made much closer by adjusting their output. We do extensive post-processing on responses before displaying a suggestion, including:
- filtering out special tokens
- stopping early when re-generating code
- fixing indentation
We will also occasionally entirely filter out responses if they are bad. This is often due to extreme repetition.

View file

@ -9,24 +9,6 @@ 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.
## See when ghost text appears
## Accepting suggestions
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.
## Accept the suggestions
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.
:::tip
Only getting single-line suggestions?
To ensure multi-line completions, update your `tabAutocompleteOptions` with the following:
```json title="config.json"
"tabAutocompleteOptions": {
"multilineCompletions": "always"
},
```
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.
:::
Accept a full suggestion by pressing `Tab`, or reject it with `Esc`. For more granular control, use `cmd/ctrl+→` to accept parts of the suggestion word-by-word.

View file

@ -20,6 +20,10 @@ For the best autocomplete experience, we recommend using Codestral through the [
}
```
:::tip[Codestral API Key]
The API keys for Codestral and the general Mistral APIs are different. If you are using Codestral, you probably want a Codestral API key, but if you are sharing the key as a team or otherwise want to use `api.mistral.ai`, then make sure to set `"apiBase": "https://api.mistral.ai/v1"` in your `tabAutocompleteModel`.
:::
## Self Hosted / Local
For those preferring local execution or self-hosting, StarCoder2-3b offers a good balance of performance and quality for most users:
@ -36,11 +40,13 @@ For those preferring local execution or self-hosting, StarCoder2-3b offers a goo
### Alternatives
- Need to be faster? 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.
- 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.
:::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 in your configuration.
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.
:::
## More