Repository navigation
refactor: pass the reverse insert mode to get_text_edit_range explicitly - #3066
Merged
Merged
Conversation
lsp_select_completion runs synchronously from within commit_completion, so it is the place where the LspCommitCompletionWithOppositeInsertMode flag can be read reliably. Read it there and pass it on, instead of having get_text_edit_range read the flag whenever it happens to be called. This keeps the opposite insert mode working once the completion is applied later, for example after resolving the completion item. Assisted-By: Claude Code:claude-opus-5-5
Member
Author
|
Something that doesn't matter today but it's the correct thing to do and will matter if we go with #2632 |
Member
Author
|
This is a trivial change that does not change any behavior so not waiting for review. |
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.
get_text_edit_rangeused to readLspCommitCompletionWithOppositeInsertMode.activeitself, so it only picked the opposite insert mode while it happened to run insidelsp_commit_completion_with_opposite_insert_mode. That holds today becauselsp_select_completionapplies the completion synchronously from withincommit_completion, but it breaks as soon as the edit is applied later, for example after resolving the completion item first.lsp_select_completionnow reads the flag when it starts, which is reliably insidecommit_completion, and passes it toget_text_edit_rangeas a keyword-onlyreverse_insert_modeargument.LspCommitCompletionWithOppositeInsertModestill sets the flag aroundcommit_completionand resets it afterwards, so it can't leak into a later completion. That matters foralt+enteron a non-LSP item, such as a word completion, wherelsp_select_completionnever runs.There is no change in behavior. This is split out of the work on resolving completion items before applying them.
Assisted-By: Claude Code:claude-opus-5-5