Changesets · Branches · Tags · Compare
| Changeset | d691089ac9f799b121efc2dab12e8198b25ef8df5ea2df2d184d4e1aa63d313e |
|---|---|
| Author | Patrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-12 17:12 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-06-12 17:12 -07:00 |
| Parents | 5fc2af2ce6c9, ff6e3c1dcf5b |
10 files changed
modified binary/package-lock.json +3 −2
| @@ -52,7 +52,7 @@ | ||
| 52 | 52 | "@aws-sdk/credential-providers": "^3.778.0", |
| 53 | 53 | "@continuedev/config-types": "^1.0.13", |
| 54 | 54 | "@continuedev/config-yaml": "file:../packages/config-yaml", |
| 55 | - "@continuedev/fetch": "^1.0.10", | |
| 55 | + "@continuedev/fetch": "^1.0.13", | |
| 56 | 56 | "@continuedev/llm-info": "^1.0.8", |
| 57 | 57 | "@continuedev/openai-adapters": "^1.0.25", |
| 58 | 58 | "@modelcontextprotocol/sdk": "^1.12.0", |
| @@ -144,7 +144,8 @@ | ||
| 144 | 144 | "onnxruntime-common": "1.14.0", |
| 145 | 145 | "onnxruntime-web": "1.14.0", |
| 146 | 146 | "ts-jest": "^29.1.1", |
| 147 | - "typescript": "^5.6.3" | |
| 147 | + "typescript": "^5.6.3", | |
| 148 | + "vitest": "^3.1.4" | |
| 148 | 149 | }, |
| 149 | 150 | "engines": { |
| 150 | 151 | "node": ">=20.19.0" |
modified core/autocomplete/CompletionProvider.ts +7 −2
| @@ -127,6 +127,7 @@ | ||
| 127 | 127 | public async provideInlineCompletionItems( |
| 128 | 128 | input: AutocompleteInput, |
| 129 | 129 | token: AbortSignal | undefined, |
| 130 | + force?: boolean, | |
| 130 | 131 | ): Promise<AutocompleteOutcome | undefined> { |
| 131 | 132 | try { |
| 132 | 133 | // Create abort signal if not given |
| @@ -146,8 +147,12 @@ | ||
| 146 | 147 | const options = await this._getAutocompleteOptions(llm); |
| 147 | 148 | |
| 148 | 149 | // Debounce |
| 149 | - if (await this.debouncer.delayAndShouldDebounce(options.debounceDelay)) { | |
| 150 | - return undefined; | |
| 150 | + if (!force) { | |
| 151 | + if ( | |
| 152 | + await this.debouncer.delayAndShouldDebounce(options.debounceDelay) | |
| 153 | + ) { | |
| 154 | + return undefined; | |
| 155 | + } | |
| 151 | 156 | } |
| 152 | 157 | |
| 153 | 158 | if (llm.promptTemplates?.autocomplete) { |
modified core/package-lock.json +0 −0
Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.
modified docs/docs/autocomplete/how-to-use-it.md +4 −0
| @@ -23,3 +23,7 @@ | ||
| 23 | 23 | ### Partially accepting a suggestion |
| 24 | 24 | |
| 25 | 25 | For more granular control, use <kbd>cmd/ctrl</kbd> + <kbd>→</kbd> to accept parts of the suggestion word-by-word. |
| 26 | + | |
| 27 | +### Forcing a suggestion (VS Code) | |
| 28 | + | |
| 29 | +If you want to trigger a suggestion immediately without waiting, or if you've dismissed a suggestion and want a new one, you can force it by using the keyboard shortcut **<kbd>cmd/ctrl</kbd> + <kbd>alt</kbd> + <kbd>space</kbd>**. |
modified extensions/vscode/e2e/actions/Autocomplete.actions.ts +14 −1
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | import { expect } from "chai"; |
| 2 | -import { TextEditor } from "vscode-extension-tester"; | |
| 2 | +import { TextEditor, VSBrowser, Workbench } from "vscode-extension-tester"; | |
| 3 | 3 | |
| 4 | 4 | import { DEFAULT_TIMEOUT } from "../constants"; |
| 5 | 5 | import { AutocompleteSelectors } from "../selectors/Autocomplete.selectors"; |
| @@ -29,4 +29,17 @@ | ||
| 29 | 29 | ); |
| 30 | 30 | expect(ghostText1).to.equal(messagePair1.llmResponse); |
| 31 | 31 | } |
| 32 | + | |
| 33 | + public static async forceCompletion(editor: TextEditor): Promise<string> { | |
| 34 | + await editor.setText("def main():\n "); | |
| 35 | + await editor.moveCursor(2, 5); | |
| 36 | + | |
| 37 | + await new Workbench().executeCommand("Continue: Force Autocomplete"); | |
| 38 | + | |
| 39 | + const ghostText = await TestUtils.waitForSuccess(() => | |
| 40 | + AutocompleteSelectors.getGhostTextContent(VSBrowser.instance.driver) | |
| 41 | + ); | |
| 42 | + | |
| 43 | + return ghostText; | |
| 44 | + } | |
| 32 | 45 | } |
modified extensions/vscode/e2e/tests/Autocomplete.test.ts +5 −0
| @@ -1,3 +1,4 @@ | ||
| 1 | +import { expect } from "chai"; | |
| 1 | 2 | import { EditorView, TextEditor } from "vscode-extension-tester"; |
| 2 | 3 | |
| 3 | 4 | import { AutocompleteActions } from "../actions/Autocomplete.actions"; |
| @@ -23,4 +24,8 @@ | ||
| 23 | 24 | it("Should display completions", async () => { |
| 24 | 25 | await AutocompleteActions.testCompletions(editor); |
| 25 | 26 | }).timeout(DEFAULT_TIMEOUT.XL); |
| 27 | + it("Should force a completion using the command", async () => { | |
| 28 | + const ghostText = await AutocompleteActions.forceCompletion(editor); | |
| 29 | + expect(ghostText).to.not.be.empty; | |
| 30 | + }).timeout(DEFAULT_TIMEOUT.XL); | |
| 26 | 31 | }); |
modified extensions/vscode/package.json +11 −0
| @@ -225,6 +225,11 @@ | ||
| 225 | 225 | "title": "Toggle Autocomplete Enabled", |
| 226 | 226 | "group": "Continue" |
| 227 | 227 | }, |
| 228 | + { | |
| 229 | + "command": "continue.forceAutocomplete", | |
| 230 | + "title": "Continue: Force Autocomplete", | |
| 231 | + "category": "Continue" | |
| 232 | + }, | |
| 228 | 233 | { |
| 229 | 234 | "command": "continue.selectFilesAsContext", |
| 230 | 235 | "category": "Continue", |
| @@ -411,6 +416,12 @@ | ||
| 411 | 416 | "key": "ctrl+k ctrl+a", |
| 412 | 417 | "when": "!terminalFocus" |
| 413 | 418 | }, |
| 419 | + { | |
| 420 | + "command": "continue.forceAutocomplete", | |
| 421 | + "key": "ctrl+alt+space", | |
| 422 | + "mac": "cmd+alt+space", | |
| 423 | + "when": "editorTextFocus && !editorHasSelection && !editorReadOnly && !inSnippetMode" | |
| 424 | + }, | |
| 414 | 425 | { |
| 415 | 426 | "command": "continue.applyCodeFromChat", |
| 416 | 427 | "mac": "alt+a", |
modified extensions/vscode/src/autocomplete/completionProvider.ts +5 −0
| @@ -189,6 +189,10 @@ | ||
| 189 | 189 | // Handle commit message input box |
| 190 | 190 | let manuallyPassPrefix: string | undefined = undefined; |
| 191 | 191 | |
| 192 | + // handle manual autocompletion trigger | |
| 193 | + const wasManuallyTriggered = | |
| 194 | + context.triggerKind === vscode.InlineCompletionTriggerKind.Invoke; | |
| 195 | + | |
| 192 | 196 | const input: AutocompleteInput = { |
| 193 | 197 | pos, |
| 194 | 198 | manuallyPassFileContents, |
| @@ -208,6 +212,7 @@ | ||
| 208 | 212 | await this.completionProvider.provideInlineCompletionItems( |
| 209 | 213 | input, |
| 210 | 214 | signal, |
| 215 | + wasManuallyTriggered, | |
| 211 | 216 | ); |
| 212 | 217 | |
| 213 | 218 | if (!outcome || !outcome.completion) { |
modified extensions/vscode/src/commands.ts +12 −0
| @@ -624,6 +624,18 @@ | ||
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | }, |
| 627 | + "continue.forceAutocomplete": async () => { | |
| 628 | + captureCommandTelemetry("forceAutocomplete"); | |
| 629 | + | |
| 630 | + // 1. Explicitly hide any existing suggestion. This clears VS Code's cache for the current position. | |
| 631 | + await vscode.commands.executeCommand("editor.action.inlineSuggest.hide"); | |
| 632 | + | |
| 633 | + // 2. Now trigger a new one. VS Code has no cached suggestion, so it's forced to call our provider. | |
| 634 | + await vscode.commands.executeCommand( | |
| 635 | + "editor.action.inlineSuggest.trigger", | |
| 636 | + ); | |
| 637 | + }, | |
| 638 | + | |
| 627 | 639 | "continue.openTabAutocompleteConfigMenu": async () => { |
| 628 | 640 | captureCommandTelemetry("openTabAutocompleteConfigMenu"); |
| 629 | 641 |
modified gui/src/pages/config/KeyboardShortcuts.tsx +4 −0
| @@ -75,6 +75,10 @@ | ||
| 75 | 75 | shortcut: "cmd K cmd A", |
| 76 | 76 | description: "Toggle Autocomplete Enabled", |
| 77 | 77 | }, |
| 78 | + { | |
| 79 | + shortcut: "cmd alt space", | |
| 80 | + description: "Force an Autocomplete Trigger", | |
| 81 | + }, | |
| 78 | 82 | { |
| 79 | 83 | shortcut: "cmd K cmd M", |
| 80 | 84 | description: "Toggle Full Screen", |