-
-
Notifications
You must be signed in to change notification settings - Fork 664
Closed
Copy link
Labels
A-CoreArea: coreArea: coreS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bug
Description
VS Code version
1.101.14098
Extension version
3.0.3
Biome version
2.0.5
Operating system
- Windows
- macOS
- Linux
Description
Since upgrading Biome to version 2.0.0, formatting on save with .astro
files completely removes all code that is not inside frontmatter.
When running pnpm biome check --fix src/test.astro
in the terminal, everything runs as expected.
The only thing I could find related to this is an issue with the Zed extension where I am also experiencing the issue. biomejs/biome-zed#60
Steps to reproduce
- Clone the MRE repo
- Open
src/test.astro
in VS Code with the biome extension installed - Save the file and watch it format and strip out all code except for the frontmatter
From this:
---
const useSortedKeys = {
2: "two",
3: "three",
1: "one",
4: "four",
};
let useConst = "Astro Test";
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{useConst}</title>
</head>
<body>
<h1>{useConst}</h1>
<ol>
{Object.values(useSortedKeys).map((val) => <li>{val}</li>)}
</ol>
</body>
</html>
To this:
const useSortedKeys = {
1: "one",
2: "two",
3: "three",
4: "four",
};
const useConst = "Astro Test";
Expected behavior
The formatting is expected to be the same as when running pnpm biome check --fix src/test.astro
:
---
const useSortedKeys = {
1: "one",
2: "two",
3: "three",
4: "four",
};
const useConst = "Astro Test";
---
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{useConst}</title>
</head>
<body>
<h1>{useConst}</h1>
<ol>
{Object.values(useSortedKeys).map((val) => <li>{val}</li>)}
</ol>
</body>
</html>
Does this issue occur when using the CLI directly?
No
Link to a minimal reproduction
https://github.com/oddmouse/biome-astro-format-on-save-mre
Logs
schickling, emilienbidet and tonyemilienbidet
Metadata
Metadata
Assignees
Labels
A-CoreArea: coreArea: coreS-Bug-confirmedStatus: report has been confirmed as a valid bugStatus: report has been confirmed as a valid bug