Elffuss BraidHub

kikocis/continue public

275abb44c5e4 · 7.8 KiBRawPermalink
1---
2title: "Autocomplete"
3description: "Deep dive into Continue's autocomplete functionality and configuration"
4keywords: [autocomplete]
5---
6
7### Setting up with Codestral (recommended)
8
9If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the [Mistral API](https://console.mistral.ai/). To do this, obtain an API key and add it to your config:
10
11<Tabs>
12 <Tab title="Hub">
13 [Mistral Codestral model block](https://hub.continue.dev/mistral/codestral)
14 </Tab>
15 <Tab title="YAML">
16 ```yaml title="config.yaml"
17 models:
18 - name: Codestral
19 provider: mistral
20 model: codestral-latest
21 apiKey: <YOUR_CODESTRAL_API_KEY>
22 roles:
23 - autocomplete
24 ```
25 </Tab>
26 <Tab title="JSON">
27 ```json title="config.json"
28 {
29 "tabAutocompleteModel": {
30 "title": "Codestral",
31 "provider": "mistral",
32 "model": "codestral-latest",
33 "apiKey": "<YOUR_CODESTRAL_API_KEY>"
34 }
35 }
36 ```
37 </Tab>
38</Tabs>
39
40<Tip>
41 **Codestral API Key**: The API keys for Codestral and the general Mistral APIs
42 are different. If you are using Codestral, you probably want a Codestral API
43 key, but if you are sharing the key as a team or otherwise want to use
44 `api.mistral.ai`, then make sure to set `"apiBase":
45 "https://api.mistral.ai/v1"` in your `tabAutocompleteModel`.
46</Tip>
47
48### Setting up with Ollama (default)
49
50If 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](https://ollama.ai). Then, run the following command to download our recommended model:
51
52```bash
53ollama run qwen2.5-coder:1.5b
54```
55
56Then, add the model to your configuration:
57
58<Tabs>
59 <Tab title="Hub">
60 [Ollama Qwen 2.5 Coder 1.5B model block](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b)
61 </Tab>
62 <Tab title="YAML">
63 ```yaml title="config.yaml"
64 models:
65 - name: Qwen 1.5b Autocomplete Model
66 provider: ollama
67 model: qwen2.5-coder:1.5b
68 roles:
69 - autocomplete
70 ```
71 </Tab>
72 <Tab title="JSON">
73 ```json title="config.json"
74 {
75 "tabAutocompleteModel": {
76 "title": "Qwen 1.5b Autocomplete Model",
77 "provider": "ollama",
78 "model": "qwen2.5-coder:1.5b",
79 }
80 }
81 ```
82 </Tab>
83</Tabs>
84
85Once the model has been downloaded, you should begin to see completions in VS Code.
86
87## Configuration Options
88
89### Hub Autocomplete models
90
91Explore autocomplete model configurations on [the hub](https://hub.continue.dev/explore/models?roles=autocomplete)
92
93### Autocomplete User Settings
94
95{/* - `Use autocomplete cache`: If on, caches completions */}
96The following settings can be configured for autocompletion in the IDE extension [User Settings Page](../settings.md):
97
98- `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto`
99- `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt"
100
101### `config.json` Configuration
102
103The `config.json` configuration format (deprecated) offers further configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference) for more details.
104
105## FAQs
106
107### I want better completions, should I use GPT-4?
108
109Perhaps 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](https://github.com/continuedev/continue/blob/main/core/autocomplete/templating/AutocompleteTemplate.ts)). 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.
110
111### I'm not seeing any completions
112
113Follow these steps to ensure that everything is set up correctly:
114
1151. 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).
1162. Make sure you have downloaded Ollama.
1173. Run `ollama run qwen2.5-coder:1.5b` to verify that the model is downloaded.
1184. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere.
1195. Check the output of the logs to find any potential errors: <kbd>cmd/ctrl</kbd> + <kbd>shift</kbd> + <kbd>P</kbd> -> "Toggle Developer Tools" -> "Console" tab in VS Code, ~/.continue/logs/core.log in JetBrains.
1206. Check VS Code settings to make sure that `"editor.inlineSuggest.enabled"` is set to `true` (use <kbd>cmd/ctrl</kbd> + <kbd>,</kbd> then search for this and check the box)
1217. If you are still having issues, please let us know in our [Discord](https://discord.gg/vapESyrFmJ) and we'll help as soon as possible.
122
123### Completions are only ever single-line
124
125To 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.
126
127### Can I configure a "trigger key" for autocomplete?
128
129Yes, in VS Code, if you don't want to be shown suggestions automatically you can:
130
1311. Set `"editor.inlineSuggest.enabled": false` in VS Code settings to disable automatic suggestions
1322. Open "Keyboard Shortcuts" (cmd/ctrl+k, cmd/ctrl+s) and search for `editor.action.inlineSuggest.trigger`
1333. Click the "+" icon to add a new keybinding
1344. Press the key combination you want to use to trigger suggestions (e.g. <kbd>cmd/ctrl</kbd> + <kbd>space</kbd>)
1355. Now whenever you want to see a suggestion, you can press your key binding (e.g. <kbd>cmd/ctrl</kbd> + <kbd>space</kbd>) to trigger suggestions manually
136
137### Is there a shortcut to accept one line at a time?
138
139This is a built-in feature of VS Code, but it's just a bit hidden. Follow these settings to reassign the keyboard shortcuts in VS Code:
140
1411. Press `Ctrl+Shift+P`, type the command: `Preferences: Open Keyboard Shortcuts`, and enter the keyboard shortcuts settings page.
1422. Search for `editor.action.inlineSuggest.acceptNextLine`.
1433. Set the key binding to `Tab`.
1444. Set the trigger condition (when) to `inlineSuggestionVisible && !editorReadonly`.
145 This will make multi-line completion (including continue and from VS Code built-in or other plugin snippets) still work, and you will see multi-line completion. However, Tab will only fill in one line at a time. Any unnecessary code can be canceled with `Esc`.
146 If you need to apply all the code, just press `Tab` multiple times.
147
148### How to turn off autocomplete
149
150#### VS Code
151
152Click 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.
153
154Alternatively, open VS Code settings, search for "Continue" and uncheck the box for "Enable Tab Autocomplete".
155
156You can also use the default shortcut to disable autocomplete directly using a chord: press and hold <kbd>ctrl/cmd</kbd> + <kbd>K</kbd> (continue holding <kbd>ctrl/cmd</kbd>) and press <kbd>ctrl/cmd</kbd> + <kbd>A</kbd>. This will turn off autocomplete without navigating through settings.
157
158#### JetBrains
159
160Open Settings -> Tools -> Continue and uncheck the box for "Enable Tab Autocomplete".
161
162#### Feedback
163
164If you're turning off autocomplete, we'd love to hear how we can improve! Please let us know in our [Discord](https://discord.gg/vapESyrFmJ) or file an issue on GitHub.