VS Code version
1.101.14098
Extension version
3.0.3
Biome version
2.0.5
Operating system
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
VS Code version
1.101.14098
Extension version
3.0.3
Biome version
2.0.5
Operating system
Description
Since upgrading Biome to version 2.0.0, formatting on save with
.astrofiles completely removes all code that is not inside frontmatter.When running
pnpm biome check --fix src/test.astroin 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
src/test.astroin VS Code with the biome extension installedFrom this:
To this:
Expected behavior
The formatting is expected to be the same as when running
pnpm biome check --fix src/test.astro: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