Add force autocomplete command and update inline completion handling
- Introduced a new command `continue.forceAutocomplete` to trigger autocompletion manually. - Updated `CompletionProvider` to accept a `force` parameter for inline completion. - Enhanced `ContinueCompletionProvider` to handle manual autocompletion triggers.
This commit is contained in:
parent
7ccbf860f8
commit
77a723cdea
4 changed files with 33 additions and 2 deletions
|
|
@ -127,6 +127,7 @@ export class CompletionProvider {
|
|||
public async provideInlineCompletionItems(
|
||||
input: AutocompleteInput,
|
||||
token: AbortSignal | undefined,
|
||||
force?: boolean,
|
||||
): Promise<AutocompleteOutcome | undefined> {
|
||||
try {
|
||||
// Create abort signal if not given
|
||||
|
|
@ -146,8 +147,12 @@ export class CompletionProvider {
|
|||
const options = await this._getAutocompleteOptions(llm);
|
||||
|
||||
// Debounce
|
||||
if (await this.debouncer.delayAndShouldDebounce(options.debounceDelay)) {
|
||||
return undefined;
|
||||
if (!force) {
|
||||
if (
|
||||
await this.debouncer.delayAndShouldDebounce(options.debounceDelay)
|
||||
) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (llm.promptTemplates?.autocomplete) {
|
||||
|
|
|
|||
|
|
@ -225,6 +225,11 @@
|
|||
"title": "Toggle Autocomplete Enabled",
|
||||
"group": "Continue"
|
||||
},
|
||||
{
|
||||
"command": "continue.forceAutocomplete",
|
||||
"title": "Continue: Force Autocomplete",
|
||||
"category": "Continue"
|
||||
},
|
||||
{
|
||||
"command": "continue.selectFilesAsContext",
|
||||
"category": "Continue",
|
||||
|
|
@ -411,6 +416,17 @@
|
|||
"key": "ctrl+k ctrl+a",
|
||||
"when": "!terminalFocus"
|
||||
},
|
||||
{
|
||||
"command": "continue.forceAutocomplete",
|
||||
"key": "ctrl+alt+space",
|
||||
"when": "editorTextFocus && !editorHasSelection && !editorReadOnly && !inSnippetMode"
|
||||
},
|
||||
{
|
||||
"command": "continue.forceAutocomplete",
|
||||
"key": "cmd+alt+space",
|
||||
"mac": "cmd+alt+space",
|
||||
"when": "editorTextFocus && !editorHasSelection && !editorReadOnly && !inSnippetMode"
|
||||
},
|
||||
{
|
||||
"command": "continue.applyCodeFromChat",
|
||||
"mac": "alt+a",
|
||||
|
|
|
|||
|
|
@ -189,6 +189,10 @@ export class ContinueCompletionProvider
|
|||
// Handle commit message input box
|
||||
let manuallyPassPrefix: string | undefined = undefined;
|
||||
|
||||
// handle manual autocompletion trigger
|
||||
const wasManuallyTriggered =
|
||||
context.triggerKind === vscode.InlineCompletionTriggerKind.Invoke;
|
||||
|
||||
const input: AutocompleteInput = {
|
||||
pos,
|
||||
manuallyPassFileContents,
|
||||
|
|
@ -208,6 +212,7 @@ export class ContinueCompletionProvider
|
|||
await this.completionProvider.provideInlineCompletionItems(
|
||||
input,
|
||||
signal,
|
||||
wasManuallyTriggered,
|
||||
);
|
||||
|
||||
if (!outcome || !outcome.completion) {
|
||||
|
|
|
|||
|
|
@ -624,6 +624,11 @@ const getCommandsMap: (
|
|||
}
|
||||
}
|
||||
},
|
||||
"continue.forceAutocomplete": () => {
|
||||
captureCommandTelemetry("forceAutocomplete");
|
||||
vscode.commands.executeCommand("editor.action.inlineSuggest.trigger");
|
||||
},
|
||||
|
||||
"continue.openTabAutocompleteConfigMenu": async () => {
|
||||
captureCommandTelemetry("openTabAutocompleteConfigMenu");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue