biomejs/biome-vscode

๐Ÿ› Code is removed after formating on save

Closed this issue ยท 2 comments

VS Code version

1.90.1

Extension version

2.3.0

Biome version

1.8.1

Operating system

  • Windows
  • macOS
  • Linux

Description

Formating on save removes parts of the code. The "Format document" does not cause the bug, nor the "Save without formating". Only the format on save causes the bug.

Here's a video demonstrating the problem:

Code_0olmW70QK4.mp4

As shown in video, the if() block is deleted when saving the file, with Ctrl+S, Autosave or the action panel

I'm sure it's linked to Biome because it doesn't happen when Biome is disabled

Steps to reproduce

Saving when format on save is active causes the bug. It happens on very specific parts of code, I noticed happening on various pieces of code. It's always a recently modified part of the code that is impacted. It may be related to code following a comment, but I'm not sure about that

Expected behavior

Obviously formatting should not remove code

Does this issue occur when using the CLI directly?

Not sure / Not applicable

Logs

The Biome trace in Output is empty

Possible duplicate of biomejs/biome#2260

I confirm it's the same bug, it's fixed after changing Format On Save VS Code setting to "file" instead of "modificationIfavailable"