Autocomplete
Setting up with Codestral (recommended)
If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the Mistral API. To do this, obtain an API key and add it to your config:
- Hub
- YAML
- JSON
models:
- name: Codestral
provider: mistral
model: codestral-latest
apiKey: <YOUR_CODESTRAL_API_KEY>
roles:
- autocomplete
{
"tabAutocompleteModel": {
"title": "Codestral",
"provider": "mistral",
"model": "codestral-latest",
"apiKey": "<YOUR_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
.
Setting up with Ollama (default)
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. Then, run the following command to download our recommended model:
ollama run qwen2.5-coder:1.5b
Then, add the model to your configuration:
- Hub
- YAML
- JSON
models:
- name: Qwen 1.5b Autocomplete Model
provider: ollama
model: qwen2.5-coder:1.5b
roles:
- autocomplete
{
"tabAutocompleteModel": {
"title": "Qwen 1.5b Autocomplete Model",
"provider": "ollama",
"model": "qwen2.5-coder:1.5b",
}
}
Once the model has been downloaded, you should begin to see completions in VS Code.
Configuration Options
Hub Autocomplete models
Explore autocomplete model configurations on the hub
Autocomplete User Settings
The following settings can be configured for autocompletion in the IDE extension User Settings Page:
Use autocomplete cache
: If on, caches completionsMultiline Autocompletions
: Controls multiline completions for autocomplete. Can be set toalways
,never
, orauto
. Defaults toauto
Disable autocomplete in files
: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "_/.md, */.txt"
config.json
Configuration
The config.json
configuration format (deprecated) offers further configuration options through tabAutocompleteOptions
. See the JSON Reference for more details.
FAQs
I want better completions, should I use GPT-4?
Perhaps surprisingly, the answer is no. The models that we suggest for autocomplete are trained with a highly specific prompt format, which allows them to respond to requests for completing code (see examples of these prompts here). Some of the best commercial models like GPT-4 or Claude are not trained with this prompt format, which means that they won't generate useful completions. Luckily, a huge model is not required for great autocomplete. Most of the state-of-the-art autocomplete models are no more than 10b parameters, and increasing beyond this does not significantly improve performance.
I'm not seeing any completions
Follow these steps to ensure that everything is set up correctly:
- 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).
- Make sure you have downloaded Ollama.
- Run
ollama run qwen2.5-coder:1.5b
to verify that the model is downloaded. - Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere.
- 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.
- Check VS Code settings to make sure that
"editor.inlineSuggest.enabled"
is set totrue
(use cmd/ctrl + , then search for this and check the box) - If you are still having issues, please let us know in our Discord and we'll help as soon as possible.
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.
Can I configure a "trigger key" for autocomplete?
Yes, in VS Code, if you don't want to be shown suggestions automatically you can:
- Set
"editor.inlineSuggest.enabled": false
in VS Code settings to disable automatic suggestions - Open "Keyboard Shortcuts" (cmd/ctrl+k, cmd/ctrl+s) and search for
editor.action.inlineSuggest.trigger
- Click the "+" icon to add a new keybinding
- Press the key combination you want to use to trigger suggestions (e.g. cmd/ctrl + space)
- Now whenever you want to see a suggestion, you can press your key binding (e.g. cmd/ctrl + space) to trigger suggestions manually
Is there a shortcut to accept one line at a time?
This is a built-in feature of VS Code, but it's just a bit hidden. See this great StackOverflow answer for more details.
How to turn off autocomplete
VS Code
Click the "Continue" button in the status panel at the bottom right of the screen. The checkmark will become a "cancel" symbol and you will no longer see completions. You can click again to turn it back on.
Alternatively, open VS Code settings, search for "Continue" and uncheck the box for "Enable Tab Autocomplete".
You can also use the default shortcut to disable autocomplete directly using a chord: press and hold ctrl/cmd + K (continue holding ctrl/cmd) and press ctrl/cmd + A. This will turn off autocomplete without navigating through settings.
JetBrains
Open Settings -> Tools -> Continue and uncheck the box for "Enable Tab Autocomplete".
Feedback
If you're turning off autocomplete, we'd love to hear how we can improve! Please let us know in our Discord or file an issue on GitHub.