diff --git a/core/autocomplete/CompletionProvider.ts b/core/autocomplete/CompletionProvider.ts index 143dbf269..d51c15853 100644 --- a/core/autocomplete/CompletionProvider.ts +++ b/core/autocomplete/CompletionProvider.ts @@ -10,8 +10,8 @@ import { BracketMatchingService } from "./filtering/BracketMatchingService.js"; import { CompletionStreamer } from "./generation/CompletionStreamer.js"; import { postprocessCompletion } from "./postprocessing/index.js"; import { shouldPrefilter } from "./prefiltering/index.js"; -import { getAllSnippetsWithoutRace } from "./snippets/index.js"; import { renderPromptWithTokenLimit } from "./templating/index.js"; +import { getAllSnippetsWithoutRace } from "./snippets/index.js"; import { GetLspDefinitionsFunction } from "./types.js"; import { AutocompleteDebouncer } from "./util/AutocompleteDebouncer.js"; import { AutocompleteLoggingService } from "./util/AutocompleteLoggingService.js"; diff --git a/core/config/yaml/loadYaml.ts b/core/config/yaml/loadYaml.ts index 94aba67be..dbfd88a08 100644 --- a/core/config/yaml/loadYaml.ts +++ b/core/config/yaml/loadYaml.ts @@ -429,7 +429,6 @@ async function configYamlToContinueConfig(options: { })), false, ); - continueConfig.tabAutocompleteOptions = config.tabAutocompleteOptions; return { config: continueConfig, errors: localErrors }; } diff --git a/core/util/parameters.ts b/core/util/parameters.ts index 147c3979a..fbcdbca66 100644 --- a/core/util/parameters.ts +++ b/core/util/parameters.ts @@ -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, diff --git a/docs/customize/deep-dives/autocomplete.mdx b/docs/customize/deep-dives/autocomplete.mdx index d1ea3635e..818261ac5 100644 --- a/docs/customize/deep-dives/autocomplete.mdx +++ b/docs/customize/deep-dives/autocomplete.mdx @@ -84,7 +84,7 @@ 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. @@ -92,7 +92,7 @@ For example: - ```yaml title="config.yaml" +```yaml title="config.yaml" models: - name: Qwen3 without Thinking for Autocomplete provider: ollama @@ -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 -The `config.json` configuration format (deprecated) offers further configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference) for more details. +#### 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 offers configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference/json-reference#tabautocomplete-options) for more details. ## FAQs diff --git a/docs/reference.mdx b/docs/reference.mdx index bf9683e10..ee41e8f18 100644 --- a/docs/reference.mdx +++ b/docs/reference.mdx @@ -176,9 +176,10 @@ 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. Supported capabilities include: + - `tool_use`: Enables function/tool calling support (required for Agent mode) - `image_input`: Enables image upload and processing support - + Continue automatically detects these capabilities for most models, but you can override this when using custom deployments or if autodetection isn't working correctly. See the [Model Capabilities guide](/customize/deep-dives/model-capabilities) for detailed information. - `maxStopWords`: Maximum number of stop words allowed, to avoid API errors with extensive lists. @@ -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" @@ -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 @@ -456,6 +476,10 @@ models: model: starcoder roles: - autocomplete + autocompleteOptions: + debounceDelay: 350 + maxPromptTokens: 1024 + onlyMyCode: true defaultCompletionOptions: temperature: 0.3 stop: @@ -531,4 +555,8 @@ models: useLegacyCompletionsEndpoint: false roles: - autocomplete + autocompleteOptions: + debounceDelay: 350 + maxPromptTokens: 1024 + onlyMyCode: true ``` diff --git a/docs/reference/json-reference.mdx b/docs/reference/json-reference.mdx index 7d6f40568..d775b27e5 100644 --- a/docs/reference/json-reference.mdx +++ b/docs/reference/json-reference.mdx @@ -101,6 +101,12 @@ config.json Specifies options for tab autocompletion behavior. + + **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. + + **Properties:** - `disable`: If `true`, disables tab autocomplete (default: `false`). @@ -468,16 +474,19 @@ Several experimental config parameters are available, as described below: - `defaultContext`: Defines the default context for the LLM. Uses the same format as `contextProviders` but includes an additional `query` property to specify custom query parameters.= - `modelRoles`: + - `inlineEdit`: Model title for inline edits. - `applyCodeBlock`: Model title for applying code blocks. - `repoMapFileSelection`: Model title for repo map selections. - `quickActions`: Array of custom quick actions + - `title` (**required**): Display title for the quick action. - `prompt` (**required**): Prompt for quick action. - `sendToChat`: If `true`, sends result to chat; else inserts in document. Default is `false`. - `contextMenuPrompts`: + - `comment`: Prompt for commenting code. - `docstring`: Prompt for adding docstrings. - `fix`: Prompt for fixing code. @@ -529,15 +538,18 @@ Some deprecated `config.json` settings are no longer stored in config and have b - `disableSessionTitles`/`ui.getChatTitles`: This value will be migrated to the safest merged value (`true` if either are `true`). `getChatTitles` takes precedence if set to false - `tabAutocompleteOptions` + - `useCache`: This value will override during migration. - `disableInFiles`: This value will be migrated to the safest merged value (arrays of file matches merged/deduplicated) - `multilineCompletions`: This value will override during migration. - `experimental` + - `useChromiumForDocsCrawling`: This value will override during migration. - `readResponseTTS`: This value will override during migration. - `ui` - all will override during migration + - `codeBlockToolbarPosition` - `fontSize` - `codeWrap` diff --git a/gui/src/components/mainInput/Lump/EditBlockButton.tsx b/gui/src/components/mainInput/Lump/EditBlockButton.tsx index 0bce9f642..19780e875 100644 --- a/gui/src/components/mainInput/Lump/EditBlockButton.tsx +++ b/gui/src/components/mainInput/Lump/EditBlockButton.tsx @@ -6,7 +6,7 @@ import { IdeMessengerContext } from "../../../context/IdeMessenger"; type SectionKey = Exclude< keyof ConfigYaml, - "name" | "version" | "schema" | "metadata" | "tabAutocompleteOptions" + "name" | "version" | "schema" | "metadata" >; interface EditBlockButtonProps { diff --git a/packages/config-types/src/index.ts b/packages/config-types/src/index.ts index 942f75219..a22bb00bb 100644 --- a/packages/config-types/src/index.ts +++ b/packages/config-types/src/index.ts @@ -136,27 +136,30 @@ export const uiOptionsSchema = z.object({ export type UiOptions = z.infer; export const tabAutocompleteOptionsSchema = z.object({ - disable: z.boolean().optional(), - maxPromptTokens: z.number().optional(), - debounceDelay: z.number().optional(), - maxSuffixPercentage: z.number().optional(), - prefixPercentage: z.number().optional(), + disable: z.boolean(), + maxPromptTokens: z.number(), + debounceDelay: z.number(), + maxSuffixPercentage: z.number(), + prefixPercentage: z.number(), transform: z.boolean().optional(), template: z.string().optional(), - multilineCompletions: z.enum(["always", "never", "auto"]).optional(), - slidingWindowPrefixPercentage: z.number().optional(), - slidingWindowSize: z.number().optional(), - useCache: z.boolean().optional(), - onlyMyCode: z.boolean().optional(), - useRecentlyEdited: z.boolean().optional(), - useRecentlyOpened: z.boolean().optional(), + multilineCompletions: z.enum(["always", "never", "auto"]), + slidingWindowPrefixPercentage: z.number(), + slidingWindowSize: z.number(), + useCache: z.boolean(), + onlyMyCode: z.boolean(), + useRecentlyEdited: z.boolean(), disableInFiles: z.array(z.string()).optional(), useImports: z.boolean().optional(), - // Experimental options - experimental_includeClipboard: z.boolean().optional(), - experimental_includeRecentlyVisitedRanges: z.boolean().optional(), - experimental_includeRecentlyEditedRanges: z.boolean().optional(), - experimental_includeDiff: 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< diff --git a/packages/config-yaml/src/load/unroll.ts b/packages/config-yaml/src/load/unroll.ts index 6ab35bc21..adbe45324 100644 --- a/packages/config-yaml/src/load/unroll.ts +++ b/packages/config-yaml/src/load/unroll.ts @@ -309,19 +309,11 @@ export async function unrollBlocks( const unrolledAssistant: AssistantUnrolled = { name: assistant.name, version: assistant.version, - ...(assistant.tabAutocompleteOptions && { - tabAutocompleteOptions: assistant.tabAutocompleteOptions, - }), }; const sections: (keyof Omit< ConfigYaml, - | "name" - | "version" - | "rules" - | "schema" - | "metadata" - | "tabAutocompleteOptions" + "name" | "version" | "rules" | "schema" | "metadata" >)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"]; // Process all sections in parallel diff --git a/packages/config-yaml/src/schemas/index.ts b/packages/config-yaml/src/schemas/index.ts index dc1ff9c9d..e15a5655d 100644 --- a/packages/config-yaml/src/schemas/index.ts +++ b/packages/config-yaml/src/schemas/index.ts @@ -1,4 +1,3 @@ -import { tabAutocompleteOptionsSchema } from "@continuedev/config-types"; import * as z from "zod"; import { commonModelSlugs } from "./commonSlugs.js"; import { dataSchema } from "./data/index.js"; @@ -146,7 +145,6 @@ export const configYamlSchema = baseConfigYamlSchema.extend({ .optional(), prompts: z.array(blockOrSchema(promptSchema)).optional(), docs: z.array(blockOrSchema(docSchema)).optional(), - tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(), }); export type ConfigYaml = z.infer; @@ -159,7 +157,6 @@ export const assistantUnrolledSchema = baseConfigYamlSchema.extend({ rules: z.array(ruleSchema.nullable()).optional(), prompts: z.array(promptSchema.nullable()).optional(), docs: z.array(docSchema.nullable()).optional(), - tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(), }); export type AssistantUnrolled = z.infer; @@ -172,7 +169,6 @@ export const assistantUnrolledSchemaNonNullable = baseConfigYamlSchema.extend({ rules: z.array(ruleSchema).optional(), prompts: z.array(promptSchema).optional(), docs: z.array(docSchema).optional(), - tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(), }); export type AssistantUnrolledNonNullable = z.infer< @@ -258,7 +254,6 @@ export const configSchema = z.object({ proxy: z.string().optional(), api_base: z.string().optional(), api_key: z.string().optional(), - tabAutocompleteOptions: tabAutocompleteOptionsSchema.optional(), }); export type Config = z.infer; diff --git a/packages/config-yaml/src/schemas/models.ts b/packages/config-yaml/src/schemas/models.ts index 283ec6781..b6e511e2a 100644 --- a/packages/config-yaml/src/schemas/models.ts +++ b/packages/config-yaml/src/schemas/models.ts @@ -119,6 +119,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 */