copilot: Clear completions upon discard#40185
Merged
benbrandt merged 4 commits intozed-industries:mainfrom Mar 17, 2026
Merged
Conversation
Collaborator
|
Sorry for the delay here @timvermeulen, I'll grab someone from the AI team to review. Thank you! |
Member
|
clippy is unhappy (and you might need to rebase for the rest of CI to work) |
Veykril
pushed a commit
that referenced
this pull request
Apr 2, 2026
Follow-up of #40185 Release Notes: - N/A
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37836
This behavior was already fixed for Supermaven in #37047, but is still present in Copilot. What's actually happening:
Editor::selectwhich starts out by callingEditor::hide_context_menu->Editor::update_visible_edit_prediction, bringing back the prediction that was just dismissed and updating the editor's display mapEditor::selectnow operates using a display map that is inconsistent with what the user saw when clickingEditor::selectthinks the user clicked on the inlay and does nothing, and the inlay reappearsUltimately,
Editor::selectshould be handling the user input using the same display map that the user saw when making the input. This can obviously be solved in multiple ways, I chose to clear the current completions inCopilotCompletionProvider::discardsuch that any subsequent calls toEditor::update_visible_edit_predictiondoesn't immediately nullify the dismissal of the edit prediction by the user.Note that this also changes the behavior that occurs after dismissing an edit prediction, moving to a different position in the buffer, and then returning: currently, this resurfaces the dismissed edit prediction (which the
test_copilottest exercises), and after this change it doesn’t. This current behavior didn't seem desirable to me because it doesn't happen when using Zeta or Supermaven, but if we want to keep it, then we could fix the incorrect selection behavior some other way.Release Notes: