SingleUpdatedNextEdit: Correctly apply insertion changes#281519
Merged
benibenj merged 2 commits intomicrosoft:mainfrom Dec 15, 2025
Merged
SingleUpdatedNextEdit: Correctly apply insertion changes#281519benibenj merged 2 commits intomicrosoft:mainfrom
benibenj merged 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an issue in inline edit suggestions where insertion changes were not correctly handled. When a user types characters that match the beginning of a suggested replacement text, the system now properly maintains the original text range that should be replaced.
Key Changes:
- Fixed the logic for handling insertion changes at the start of inline edit suggestions
- Added a comprehensive test case to verify the fix
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.ts | Changed line 676 to properly shift both start and end boundaries of the replace range when user types matching suggestion text, preserving the original text to be replaced |
| src/vs/editor/contrib/inlineCompletions/test/browser/inlineEdits.test.ts | Added test fixture with new marker position and test case to verify correct handling of typing at inline edit suggestion boundary |
src/vs/editor/contrib/inlineCompletions/test/browser/inlineEdits.test.ts
Outdated
Show resolved
Hide resolved
3c0734c to
96db79d
Compare
96db79d to
496f421
Compare
hediet
previously approved these changes
Dec 12, 2025
alexr00
previously approved these changes
Dec 12, 2025
Contributor
Author
|
I think workflows need to be approved to run since I'm not from VSCode team. Thanks for review! |
auto-merge was automatically disabled
December 12, 2025 22:35
Head branch was pushed to by a user without write access
Contributor
Author
|
Fixed code style error. |
benibenj
approved these changes
Dec 14, 2025
Contributor
|
CI is failing... I've reran failing jobs. |
dmitrivMS
approved these changes
Dec 15, 2025
Contributor
|
@yavanosta thank you very much for a great PR with good description and test coverage! ❤️ |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Currently when changes are applied to a
SingleUpdatedNextEditinsertions are applied not entirely correctly.In case if:
We do the following:
What is the problem:
Why this is incorrect:
Here is an example:
If the user types
l, the system goes to this state:It is correct to assume that we only want to insert
o world";now, but we still want to replace"char.So we should move both start and end edge of replace range.
Fixes #281520