diff --git a/core/autocomplete/completionProvider.ts b/core/autocomplete/completionProvider.ts index 62d0e2f21..e3ac76e71 100644 --- a/core/autocomplete/completionProvider.ts +++ b/core/autocomplete/completionProvider.ts @@ -384,6 +384,11 @@ export class CompletionProvider { ...config.tabAutocompleteOptions, }; + // Allow disabling autocomplete from config.json + if (options.disable) { + return undefined; + } + if (CompletionProvider.debouncing) { CompletionProvider.debounceTimeout?.refresh(); const lastUUID = await new Promise((resolve) => diff --git a/core/autocomplete/parameters.ts b/core/autocomplete/parameters.ts index 3d1ba676e..f0ed416ed 100644 --- a/core/autocomplete/parameters.ts +++ b/core/autocomplete/parameters.ts @@ -1,6 +1,7 @@ import { TabAutocompleteOptions } from ".."; export const DEFAULT_AUTOCOMPLETE_OPTS: TabAutocompleteOptions = { + disable: false, useCopyBuffer: false, useSuffix: true, maxPromptTokens: 500, diff --git a/core/index.d.ts b/core/index.d.ts index 0720068aa..7df72f6a5 100644 --- a/core/index.d.ts +++ b/core/index.d.ts @@ -630,6 +630,7 @@ export interface EmbeddingsProvider { } export interface TabAutocompleteOptions { + disable: boolean; useCopyBuffer: boolean; useSuffix: boolean; maxPromptTokens: number; diff --git a/docs/docs/walkthroughs/tab-autocomplete.md b/docs/docs/walkthroughs/tab-autocomplete.md index ecf1e5b66..9d0e9f7da 100644 --- a/docs/docs/walkthroughs/tab-autocomplete.md +++ b/docs/docs/walkthroughs/tab-autocomplete.md @@ -62,6 +62,7 @@ This object allows you to customize the behavior of tab-autocomplete. The availa - `multilineCompletions`: Whether to enable multiline completions ("always", "never", or "auto"). Defaults to "auto". - `useCache`: Whether to cache and reuse completions when the prompt is the same as a previous one. May be useful to disable for testing purposes. - `useOtherFiles`: Whether to include context from files outside of the current one. Turning this off should be expected to reduce the accuracy of completions, but might be good for testing. +- `disable`: Disable autocomplete (can also be done from IDE settings) ### Full example diff --git a/extensions/vscode/config_schema.json b/extensions/vscode/config_schema.json index 550b480bb..49f4c2ecc 100644 --- a/extensions/vscode/config_schema.json +++ b/extensions/vscode/config_schema.json @@ -1674,6 +1674,11 @@ "type": "object", "markdownDescription": "These options let you customize your tab-autocomplete experience. Read about all options in [the docs](https://continue.dev/docs/walkthroughs/tab-autocomplete#configuration-options).", "properties": { + "disable": { + "type": "boolean", + "description": "Disable tab autocomplete. This can also be done from the IDE settings.", + "default": false + }, "useCopyBuffer": { "type": "boolean", "description": "Determines whether the copy buffer will be considered when contructing the prompt."