-
Notifications
You must be signed in to change notification settings - Fork 3k
feat: Add shortcut to force autocomplete (VSCode) #6028
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
feat: Add shortcut to force autocomplete (VSCode) #6028
Conversation
- 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.
Modified the `forceAutocomplete` command to first hide any existing inline suggestion before triggering a new one. This ensures VS Code's suggestion cache is cleared, forcing it to call the provider for a fresh suggestion.
- Adds `forceCompletion` method to `AutocompleteActions` to trigger autocomplete via command. - Includes new test case to verify forced autocomplete functionality. - Attempted to test these tests to the best of my ability`
Includes details on triggering autocomplete suggestions immediately using the `cmd/ctrl + alt + space` keyboard shortcut.
Your cubic subscription is currently inactive. Please reactivate your subscription to receive AI reviews and use cubic. |
✅ Deploy Preview for continuedev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks solid, really appreciate the e2e test update! Just had one comment around a point of confusion for me but I think this should be good to go 👍
Edit: I also think we should add this new shortcut to gui/src/pages/config/KeyboardShortcuts.tsx
extensions/vscode/package.json
Outdated
{ | ||
"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" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there a reason there are two definitions of continue.forceAutocomplete here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Believe this was a Geminism that slipped past my reviewing! corrected & tested & seems to be working fine. updated the keyboard shortcut at gui/src/pages/config/KeyboardShortcuts.tsx
wasnt sure of correct syntax here. I defaulted to cmd alt space
but other keyboard shortcuts are listed as alt cmd y
let me know if I need to change this to conform
@@ -23,3 +23,7 @@ Reject a full suggestion with <kbd>Esc</kbd> | |||
### Partially accepting a suggestion | |||
|
|||
For more granular control, use <kbd>cmd/ctrl</kbd> + <kbd>→</kbd> to accept parts of the suggestion word-by-word. | |||
|
|||
### Forcing a suggestion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make it clear that this is only for VS Code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. I updated the description to add (VS Code) to the title, let me know if that addresses the requirement or if theres some style guide or recommendation I should be following here
@ShamanicArts Thank you for the contribution! Could you check this docs page out and see if your PR improves on the functionality described in the docs? We really appreciate it. |
- Update documentation to specify VS Code for forced suggestion - Remove duplicate VS Code shortcut binding in package.json - Add missing force autocomplete shortcut to GUI config
Thanks @jpoly1219, that's a great point. The key difference is that this new shortcut works while automatic suggestions are still enabled, offering a "best of both worlds" experience. It provides immediate value by allowing users to:
It also could potentially serve as a foundation for future PR, specifically allowing user to re-trigger autocompletes with slight variation in temperature or seed, essentially a "re-roll" workflow allowing the user to quickly cycle through different suggestions. |
Makes sense to me, thanks for the contribution @ShamanicArts ! 🚀 |
Description
This pull request introduces a new command and keyboard shortcut (
Cmd/Ctrl + Alt + Space
) for VS Code that allows users to manually force an autocomplete suggestion. This directly addresses the problem of wanting to trigger a suggestion without waiting for the debouncer or after dismissing a previous one.The implementation works by:
force
parameter to the coreCompletionProvider
to bypass the debounce logic. This makes the core ready for other IDEs to implement this feature.continue.forceAutocomplete
, that hides any existing suggestion and then triggers a new one.This resolves issue #6008.
Checklist
Tests
extensions/vscode/e2e/tests/Autocomplete.test.ts
(Should force a completion using the command
). This test programmatically executes thecontinue.forceAutocomplete
command and asserts that a suggestion appears.Note on Local E2E Tests: I encountered significant environmental issues with the local E2E test runner on my WSL/Windows setup. The CI/CD pipeline should be able to run the tests in a clean, consistent environment, and I am happy to address any failures that appear in the CI run.