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: Improve suggest widget interop and add feature flag #1158

Merged
merged 7 commits into from
Sep 26, 2023

Conversation

philipp-spiess
Copy link
Contributor

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

Fixes #808

This PR does a few distinct things:

  1. It fixes a bug in the completionMatchesPopupItem behavior (where we reimplement when a completion is shown in VS Code). Turns out that sometimes, with the completion range being extended to start at the beginning of the line, we don't have the right text to compare it against. This fixes it.
  2. Does some bookeeping about the previous call to the completion callback in lastCompletionRequest. We can use this to know if only the suggest widget was changed and use this to complete from the suggest widget selection. This fixes the number 1 issue people had with Autocomplete: completeSuggestWidgetSelection improvements #808 where low quality suggest widget selection caused a bad experience. Now, we only use the suggest widget if the user changed it or it happens to match the completion we would do without considering this. This results in a much nicer UX IMO.
  3. Adds a feature flag to enable this behavior

Test plan

Screen.Recording.2023-09-26.at.14.39.09.mov

(One time it appears to be buggy but you can see the backend returns go instead of og for .log 🙃

@philipp-spiess philipp-spiess changed the title WIP Autocomplete: Improve suggest widget interop and add feature flag Sep 26, 2023
@philipp-spiess philipp-spiess self-assigned this Sep 26, 2023
@philipp-spiess philipp-spiess marked this pull request as ready for review September 26, 2023 18:41
@philipp-spiess philipp-spiess merged commit 5291932 into main Sep 26, 2023
10 checks passed
@philipp-spiess philipp-spiess deleted the ps/ac-suggest-widget-improvements branch September 26, 2023 19:00
philipp-spiess added a commit that referenced this pull request Sep 26, 2023
)

Fixes #808

This PR does a few distinct things:

1. It fixes a bug in the `completionMatchesPopupItem` behavior (where we
reimplement when a completion is shown in VS Code). Turns out that
sometimes, with the completion range being extended to start at the
beginning of the line, we don't have the right text to compare it
against. This fixes it.
2. Does some bookeeping about the previous call to the completion
callback in `lastCompletionRequest`. We can use this to know if _only_
the suggest widget was changed and use this to complete from the suggest
widget selection. This fixes the number 1 issue people had with #808
where low quality suggest widget selection caused a bad experience. Now,
we only use the suggest widget if the user changed it _or_ it happens to
match the completion we would do without considering this. This results
in a much nicer UX IMO.
3. Adds a feature flag to enable this behavior

https://github.com/sourcegraph/cody/assets/458591/fd640143-a09f-4567-983c-2f32d939589e

(One time it appears to be buggy but you can see the backend returns
`go` instead of `og` for `.log` 🙃

<!-- Required. See
https://docs.sourcegraph.com/dev/background-information/testing_principles.
-->
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: completeSuggestWidgetSelection improvements
2 participants