Skip to content
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

Autocomplete: Add alt+\ shortcut to trigger autocomplete and bypass debouncing times #1060

Merged
merged 3 commits into from
Sep 14, 2023

Conversation

philipp-spiess
Copy link
Contributor

@philipp-spiess philipp-spiess commented Sep 14, 2023

Closes #1019

This adds the manual completion shortcut to trigger completions.

This change also disables the debounce timings when the completion was manually requested (that is, either using this shortcut or when hovering over completions). This is done to slightly increase latency when we already have a strong sign that the user really wants that completion

Test plan

  • Move the cursor somewhere
  • Press alt+\
  • Observe a completion being loaded
Screen.Recording.2023-09-14.at.15.20.11.mov

@philipp-spiess philipp-spiess requested review from umpox and a team September 14, 2023 13:22
@philipp-spiess philipp-spiess self-assigned this Sep 14, 2023
@philipp-spiess philipp-spiess changed the title Autocomplete: Add alt+\ shortcut Autocomplete: Add alt+\ shortcut to trigger autocomplete and bypass debouncing times Sep 14, 2023
Copy link
Contributor

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this! Needed this!

Have a question about how this helps with speed as mentioned in the changelog (still trying to understand how everything works together ☺️) but lgtm!

@@ -22,6 +22,8 @@ Starting from `0.2.0`, Cody is using `major.EVEN_NUMBER.patch` for release versi
- Enabled streaming responses for all autocomplete requests. [pull/995](https://github.com/sourcegraph/cody/pull/995)
- Sign out immediately instead of showing the quick-pick menu. [pull/1032](https://github.com/sourcegraph/cody/pull/1032)
- UX improvements to the custom command workflow (and new [custom command docs](https://docs.sourcegraph.com/cody/custom-commands)). [pull/992](https://github.com/sourcegraph/cody/pull/992)
- You can now use `alt` + `\` to trigger autocomplete requests manually. [pull/1060](https://github.com/sourcegraph/cody/pull/1060)
- Slightly reduce latency when manually triggering autocomplete requests. [pull/1060](https://github.com/sourcegraph/cody/pull/1060)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate more on how this change reduces latency, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is related to this code change: https://github.com/sourcegraph/cody/pull/1060/files#diff-0bf82c65c27367a15630425d194c46f5a66bae138f46c63361027b00161c1720R208-R212

Previously, manually triggered completions (so either using the new shortcut or by hovering over a completed text to see all possible results) would still have waited for the small 25ms/125ms debounce time - That time is so that we don't trigger toooo many network requests while typing to save some money. However for manually invoked completions we don't need that because they are already very low in volume + they are a strong sign that you want a completion NOW.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abeatrix let me know if this makes sense 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does! Thank you!

@philipp-spiess philipp-spiess merged commit 5816435 into main Sep 14, 2023
12 checks passed
@philipp-spiess philipp-spiess deleted the ps/ac-shortcut branch September 14, 2023 13:50
@umpox
Copy link
Contributor

umpox commented Sep 15, 2023

@philipp-spiess Should this bypass other restrictions too?

E.g. this code:
image

We don't produce completions here as we've discussed before, but if I forcibly request it - that might be useful? Unsure if there's a way to pick up on how the completion was triggered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autocomplete: Enable the manual trigger shortcut
3 participants