Skip to content

fix: add autocompleteOptions in the .yaml config #6895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/util/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = {
useImports: true,
transform: true,
showWhateverWeHaveAtXMs: 300,
// Experimental options: true = enabled, false = disabled, number = enabled w priority
experimental_includeClipboard: true,
experimental_includeRecentlyVisitedRanges: true,
experimental_includeRecentlyEditedRanges: true,
Expand Down
31 changes: 27 additions & 4 deletions docs/customize/deep-dives/autocomplete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ Then, add the model to your configuration:

Once the model has been downloaded, you should begin to see completions in VS Code.

NOTE: Typically, thinking-type models are not recommended as they generate more slowly and are not suitable for scenarios that require speed.
NOTE: Typically, thinking-type models are not recommended as they generate more slowly and are not suitable for scenarios that require speed.

However, if you use any thinking-switchable models, you can configure these models for autocomplete functions by turning off the thinking mode.

For example:

<Tabs>
<Tab title="YAML">
```yaml title="config.yaml"
```yaml title="config.yaml"
models:
- name: Qwen3 without Thinking for Autocomplete
provider: ollama
Expand Down Expand Up @@ -122,9 +122,32 @@ The following settings can be configured for autocompletion in the IDE extension
- `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto`
- `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt"

### `config.json` Configuration
### Autocomplete Configuration

#### YAML Configuration

The `config.yaml` format offers model-level configuration using the `autocompleteOptions` field. See the [YAML Reference](/reference#models) for more details.

```yaml
models:
- name: Codestral
provider: mistral
model: codestral-latest
roles:
- autocomplete
autocompleteOptions:
disable: false
maxPromptTokens: 1024
debounceDelay: 250
modelTimeout: 150
maxSuffixPercentage: 0.2
prefixPercentage: 0.3
onlyMyCode: true
```

#### JSON Configuration (Deprecated)

The `config.json` configuration format (deprecated) offers further configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference) for more details.
The `config.json` configuration format offers configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference/json-reference#tabautocomplete-options) for more details.

## FAQs

Expand Down
28 changes: 28 additions & 0 deletions docs/reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ The `models` section defines the language models used in your configuration. Mod

- `roles`: An array specifying the roles this model can fulfill, such as `chat`, `autocomplete`, `embed`, `rerank`, `edit`, `apply`, `summarize`. The default value is `[chat, edit, apply, summarize]`. Note that the `summarize` role is not currently used.


- `capabilities`: Array of strings denoting model capabilities, which will overwrite Continue's autodetection based on provider and model. See the [Model Capabilities guide](/customize/deep-dives/model-capabilities) for detailed information. Supported capabilities include:
- `tool_use`: Enables function/tool calling support (required for Agent mode)
- `image_input`: Enables image upload and processing support
Expand Down Expand Up @@ -228,6 +229,21 @@ The `models` section defines the language models used in your configuration. Mod
- `key`: Path to the client certificate key file.
- `passphrase`: Optional passphrase for the client certificate key file.

- `autocompleteOptions`: If the model includes role `autocomplete`, these settings apply for tab autocompletion:

- `disable`: If `true`, disables autocomplete for this model.
- `maxPromptTokens`: Maximum number of tokens for the autocomplete prompt.
- `debounceDelay`: Delay before triggering autocomplete in milliseconds.
- `modelTimeout`: Model timeout for autocomplete requests in milliseconds.
- `maxSuffixPercentage`: Maximum percentage of prompt allocated for suffix.
- `prefixPercentage`: Percentage of input allocated for prefix.
- `template`: Custom template for autocomplete using Mustache syntax. You can use the `{{{ prefix }}}`, `{{{ suffix }}}`, `{{{ filename }}}`, `{{{ reponame }}}`, and `{{{ language }}}` variables.
- `onlyMyCode`: Only includes code within the repository for context.
- `useCache`: If `true`, enables caching for completions.
- `useImports`: If `true`, includes imports in context.
- `useRecentlyEdited`: If `true`, includes recently edited files in context.
- `useRecentlyOpened`: If `true`, includes recently opened files in context.

**Example:**

```yaml title="config.yaml"
Expand All @@ -247,6 +263,10 @@ models:
model: codestral-latest
roles:
- autocomplete
autocompleteOptions:
debounceDelay: 250
maxPromptTokens: 1024
onlyMyCode: true
- name: My Model - OpenAI-Compatible
provider: openai
apiBase: http://my-endpoint/v1
Expand Down Expand Up @@ -456,6 +476,10 @@ models:
model: starcoder
roles:
- autocomplete
autocompleteOptions:
debounceDelay: 350
maxPromptTokens: 1024
onlyMyCode: true
defaultCompletionOptions:
temperature: 0.3
stop:
Expand Down Expand Up @@ -531,4 +555,8 @@ models:
useLegacyCompletionsEndpoint: false
roles:
- autocomplete
autocompleteOptions:
debounceDelay: 350
maxPromptTokens: 1024
onlyMyCode: true
```
6 changes: 6 additions & 0 deletions docs/reference/json-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ config.json

Specifies options for tab autocompletion behavior.

<Info>
**Note**: Many of these parameters can also be configured per-model using the
`autocompleteOptions` field in `config.yaml`. See the [YAML
Reference](/reference#models) for more details.
</Info>

**Properties:**

- `disable`: If `true`, disables tab autocomplete (default: `false`).
Expand Down
10 changes: 10 additions & 0 deletions packages/config-types/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ export const tabAutocompleteOptionsSchema = z.object({
useRecentlyEdited: z.boolean(),
disableInFiles: z.array(z.string()).optional(),
useImports: z.boolean().optional(),
// Experimental options: true = enabled, false = disabled, number = enabled w priority
experimental_includeClipboard: z.union([z.boolean(), z.number()]).optional(),
experimental_includeRecentlyVisitedRanges: z
.union([z.boolean(), z.number()])
.optional(),
experimental_includeRecentlyEditedRanges: z
.union([z.boolean(), z.number()])
.optional(),
experimental_includeDiff: z.union([z.boolean(), z.number()]).optional(),
experimental_enableStaticContextualization: z.boolean().optional(),
});
export type TabAutocompleteOptions = z.infer<
typeof tabAutocompleteOptionsSchema
Expand Down
10 changes: 10 additions & 0 deletions packages/config-yaml/src/schemas/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ export const autocompleteOptionsSchema = z.object({
prefixPercentage: z.number().optional(),
template: z.string().optional(),
onlyMyCode: z.boolean().optional(),
useCache: z.boolean().optional(),
useImports: z.boolean().optional(),
useRecentlyEdited: z.boolean().optional(),
useRecentlyOpened: z.boolean().optional(),
// Experimental options: true = enabled, false = disabled, number = enabled w priority
experimental_includeClipboard: z.boolean().optional(),
experimental_includeRecentlyVisitedRanges: z.boolean().optional(),
experimental_includeRecentlyEditedRanges: z.boolean().optional(),
experimental_includeDiff: z.boolean().optional(),
experimental_enableStaticContextualization: z.boolean().optional(),
});

/** Prompt templates use Handlebars syntax */
Expand Down
Loading