Elffuss BraidHub

kikocis/continue public

main · 9.7 KiBRawPermalink
1---
2title: "Continue Autocomplete Setup and Configuration Guide"
3description: "Step-by-step guide to setting up and configuring autocomplete in Continue, including Codestral, Ollama, and IDE settings."
4keywords: [autocomplete]
5sidebarTitle: Autocomplete
6---
7
8import { ModelRecommendations } from "/snippets/ModelRecommendations.jsx";
9
10## Model Recommendations for Autocomplete
11
12<ModelRecommendations role="autocomplete" />
13
14## How to Set Up Autocomplete in Continue with Codestral (Recommended)
15
16If 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:
17
18<Tabs>
19 <Tab title="Hub">
20 [Mistral Codestral model block](https://hub.continue.dev/mistral/codestral)
21 </Tab>
22 <Tab title="YAML">
23 ```yaml title="config.yaml"
24 models:
25 - name: Codestral
26 provider: mistral
27 model: codestral-latest
28 apiKey: <YOUR_CODESTRAL_API_KEY>
29 roles:
30 - autocomplete
31 ```
32 </Tab>
33 <Tab title="JSON">
34 ```json title="config.json"
35 {
36 "tabAutocompleteModel": {
37 "title": "Codestral",
38 "provider": "mistral",
39 "model": "codestral-latest",
40 "apiKey": "<YOUR_CODESTRAL_API_KEY>"
41 }
42 }
43 ```
44 </Tab>
45</Tabs>
46
47<Tip>
48 **Codestral API Key**: The API keys for Codestral and the general Mistral APIs
49 are different. If you are using Codestral, you probably want a Codestral API
50 key, but if you are sharing the key as a team or otherwise want to use
51 `api.mistral.ai`, then make sure to set `"apiBase":
52 "https://api.mistral.ai/v1"` in your `tabAutocompleteModel`.
53</Tip>
54
55## How to Set Up Autocomplete in Continue with Ollama (Local Model)
56
57If 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:
58
59```bash
60ollama run qwen2.5-coder:1.5b
61```
62
63Then, add the model to your configuration:
64
65<Tabs>
66 <Tab title="Hub">
67 [Ollama Qwen 2.5 Coder 1.5B model block](https://hub.continue.dev/ollama/qwen2.5-coder-1.5b)
68 </Tab>
69 <Tab title="YAML">
70 ```yaml title="config.yaml"
71 models:
72 - name: Qwen 1.5b Autocomplete Model
73 provider: ollama
74 model: qwen2.5-coder:1.5b
75 roles:
76 - autocomplete
77 ```
78 </Tab>
79 <Tab title="JSON">
80 ```json title="config.json"
81 {
82 "tabAutocompleteModel": {
83 "title": "Qwen 1.5b Autocomplete Model",
84 "provider": "ollama",
85 "model": "qwen2.5-coder:1.5b",
86 }
87 }
88 ```
89 </Tab>
90</Tabs>
91
92Once the model has been downloaded, you should begin to see completions in VS Code.
93
94<Note>
95 Typically, thinking-type models are not recommended as they generate more
96 slowly and are not suitable for scenarios that require speed.
97</Note>
98
99However, if you use any thinking-switchable models, you can configure these models for autocomplete functions by turning off the thinking mode.
100
101For example:
102
103<Tabs>
104<Tab title="YAML">
105
106```yaml title="config.yaml"
107models:
108 - name: Qwen3 without Thinking for Autocomplete
109 provider: ollama
110 model: qwen3:4b # qwen3 is a thinking-switchable model
111 roles:
112 - autocomplete
113 requestOptions:
114 extraBodyProperties:
115 think: false # turning off the thinking
116```
117
118</Tab>
119</Tabs>
120
121Then, in the continue panel, select this model as the default model for autocomplete.
122
123## Autocomplete Configuration Options in Continue
124
125### Autocomplete Models Available on the Continue Hub
126
127Explore autocomplete model configurations on [the hub](https://hub.continue.dev/explore/models?roles=autocomplete)
128
129### Customize Autocomplete User Settings in the Continue Extension
130
131{/* - `Use autocomplete cache`: If on, caches completions */}
132The following settings can be configured for autocompletion in the IDE extension User Settings Page:
133
134- `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto`
135- `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt"
136
137### How to Configure Autocomplete with `config.json` (Deprecated Format)
138
139#### YAML Configuration
140
141The `config.yaml` format offers model-level configuration using the `autocompleteOptions` field. See the [YAML Reference](/reference#models) for more details.
142
143```yaml
144models:
145 - name: Codestral
146 provider: mistral
147 model: codestral-latest
148 roles:
149 - autocomplete
150 autocompleteOptions:
151 disable: false
152 maxPromptTokens: 1024
153 debounceDelay: 250
154 modelTimeout: 150
155 maxSuffixPercentage: 0.2
156 prefixPercentage: 0.3
157 onlyMyCode: true
158```
159
160#### JSON Configuration (Deprecated)
161
162The `config.json` configuration format offers configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference/json-reference#tabautocomplete-options) for more details.
163
164## Autocomplete FAQs and Troubleshooting in Continue
165
166### I want better completions, should I use GPT-4?
167
168Perhaps 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.
169
170### Autocomplete Not Working – How to Fix It
171
172Follow these steps to ensure that everything is set up correctly:
173
1741. 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).
1752. Make sure you have downloaded Ollama.
1763. Run `ollama run qwen2.5-coder:1.5b` to verify that the model is downloaded.
1774. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere.
1785. 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.
1796. 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)
1807. 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.
181
182### Why Are My Completions Only Single-Line?
183
184To 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.
185
186### How to Set a Trigger Key for Autocomplete Suggestions
187
188In VS Code, if you don't want to be shown suggestions automatically you can:
189
1901. Set `"editor.inlineSuggest.enabled": false` in VS Code settings to disable automatic suggestions
1912. Open "Keyboard Shortcuts" (cmd/ctrl+k, cmd/ctrl+s) and search for `editor.action.inlineSuggest.trigger`
1923. Click the "+" icon to add a new keybinding
1934. Press the key combination you want to use to trigger suggestions (e.g. <kbd>cmd/ctrl</kbd> + <kbd>space</kbd>)
1945. 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
195
196### Shortcut for Accepting One Line at a Time in Autocomplete
197
198This 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:
199
2001. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>, type the command: `Preferences: Open Keyboard Shortcuts`, and enter the keyboard shortcuts settings page.
2012. Search for `editor.action.inlineSuggest.acceptNextLine`.
2023. Set the key binding to <kbd>Tab</kbd>.
2034. Set the trigger condition (when) to `inlineSuggestionVisible && !editorReadonly`.
204 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 <kbd>Esc</kbd>.
205 If you need to apply all the code, just press <kbd>Tab</kbd> multiple times.
206
207### How to Turn Off Autocomplete in Continue (VS Code and JetBrains)
208
209#### VS Code
210
211Click 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.
212
213Alternatively, open VS Code settings, search for "Continue" and uncheck the box for "Enable Tab Autocomplete".
214
215You 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.
216
217#### JetBrains
218
219Open Settings -> Tools -> Continue and uncheck the box for "Enable Tab Autocomplete".
220
221#### Feedback
222
223If 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.