Skip to content

Fix BulkTextEdit to prevent applying edits when document version has advanced#317286

Open
dbaeumer wants to merge 4 commits into
mainfrom
dbaeumer/divine-guan-violet
Open

Fix BulkTextEdit to prevent applying edits when document version has advanced#317286
dbaeumer wants to merge 4 commits into
mainfrom
dbaeumer/divine-guan-violet

Conversation

@dbaeumer
Copy link
Copy Markdown
Member

The changes ensure that the BulkTextEdit class correctly handles document versioning by validating the version before applying edits. This prevents edits from being applied when the text document version has advanced, addressing the issue reported in #317275.
Fixes #317275

BulkTextEdit applies edit although text document version has advanced.
Copilot AI review requested due to automatic review settings May 19, 2026 10:13
@dbaeumer dbaeumer self-assigned this May 19, 2026
@dbaeumer dbaeumer requested a review from hediet May 19, 2026 10:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a correctness issue in bulk text editing where version checks could be bypassed when edits are minimized asynchronously, leading to edits being applied even after the underlying document version has advanced (issue #317275).

Changes:

  • Preserve the original versionId when converting computed “more minimal” edits into ResourceTextEdits so downstream validation can reject stale edits.
  • Add inline commentary explaining the intent of propagating versionId through the minimization path.
Show a summary per file
File Description
src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts Propagates versionId into minimized edits so ModelEditTask.validate() can detect model version drift and prevent stale edit application.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 2

Comment thread src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts
Comment thread src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.ts
@dbaeumer dbaeumer marked this pull request as ready for review May 19, 2026 13:05
@dbaeumer dbaeumer enabled auto-merge May 19, 2026 13:07
@dbaeumer dbaeumer removed the request for review from hediet May 19, 2026 13:08
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.

BulkTextEdit applies edit although text document version has advanced.

2 participants