Skip to content

Replace All operation unexpectedly emptied the content of hundreds of .htm files #312397

@lnourson

Description

@lnourson

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: (ex: 1.89.1)
  • OS Version: (ex: Windows 10 / Windows 11)

Steps to Reproduce:

  1. Open a single-folder workspace containing many .htm files.
    (Note: several dozen files were open in the editor.)
  2. Live Server extension active.
  3. Perform a global Replace All from the search panel.
    Replacement pattern used:
    .css?v=c".css?v=d"
  4. Observe that many .htm files are unexpectedly emptied.

Description:

During a global Replace All operation in Visual Studio Code, I encountered a severe issue:

➡️ VS Code emptied the entire content of hundreds of my .htm files.

Only .htm files were affected, but the impact was extremely damaging.

Context:

  • Workspace: a single folder opened directly (not multi-root)
  • Several dozen files were open in the editor
  • Extensions active: Live Server
  • Git was not initialized
  • Regex was disabled
  • Replace All was triggered from the global search panel
  • Replacement pattern:
    .css?v=c".css?v=d"

Observed behavior:

  • After clicking Replace All, VS Code emptied the content of a very large number of .htm files
  • No warning or confirmation dialog appeared
  • Fortunately, not all files were emptied, but almost half of them

Expected behavior:

  • Replace All should never delete the entire content of files
  • A confirmation dialog should appear when many files will be modified
  • Replace All should only modify matched text, not wipe files
  • VS Code should not silently corrupt or empty files under any circumstances

Impact:
This resulted in the loss of hundreds of HTML files and required manual recovery.
This behavior is extremely dangerous for users working on large projects.

Additional notes:
I can provide more details or logs if needed.

Thank you note:
Despite this incident, I want to sincerely thank the VS Code team for this amazing tool.
I use it every day and it has become essential to my work.
Your work is truly appreciated — thank you for building and maintaining such a powerful and inspiring editor.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions