Skip to content

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

Merged
merged 7 commits into from
Jun 13, 2025

Conversation

ShamanicArts
Copy link
Contributor

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:

  1. Adding a force parameter to the core CompletionProvider to bypass the debounce logic. This makes the core ready for other IDEs to implement this feature.
  2. Registering a new VS Code-specific command, continue.forceAutocomplete, that hides any existing suggestion and then triggers a new one.

This resolves issue #6008.

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Tests

  • Manual Testing: The feature has been manually tested in VS Code. The shortcut successfully triggers an immediate suggestion, and it correctly forces a new generation even after a previous suggestion at the same position was rejected.
  • Automated Testing: An End-to-End test has been added in extensions/vscode/e2e/tests/Autocomplete.test.ts (Should force a completion using the command). This test programmatically executes the continue.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.

- 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.
@ShamanicArts ShamanicArts requested a review from a team as a code owner June 7, 2025 04:21
@ShamanicArts ShamanicArts requested review from Patrick-Erichsen and removed request for a team June 7, 2025 04:21
Copy link

cubic-dev-ai bot commented Jun 7, 2025

Your cubic subscription is currently inactive. Please reactivate your subscription to receive AI reviews and use cubic.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 7, 2025
Copy link

netlify bot commented Jun 7, 2025

Deploy Preview for continuedev ready!

Name Link
🔨 Latest commit 573478a
🔍 Latest deploy log https://app.netlify.com/projects/continuedev/deploys/684b3463b149780008c99c9b
😎 Deploy Preview https://deploy-preview-6028--continuedev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

github-actions bot commented Jun 7, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@ShamanicArts
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen left a 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

Comment on lines 419 to 429
{
"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"
},
Copy link
Collaborator

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?

Copy link
Contributor Author

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

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 12, 2025
@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jun 12, 2025
@@ -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
Copy link
Collaborator

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

Copy link
Contributor Author

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

@jpoly1219
Copy link
Collaborator

@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
@ShamanicArts
Copy link
Contributor Author

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:

  1. Manually force a request if one is missed due to a slow model or network.
  2. Re-trigger a suggestion after accidentally dismissing it.

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.

@Patrick-Erichsen
Copy link
Collaborator

Makes sense to me, thanks for the contribution @ShamanicArts ! 🚀

@Patrick-Erichsen Patrick-Erichsen merged commit 00911c6 into continuedev:main Jun 13, 2025
35 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Jun 13, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants