Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/format_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn format_text(file_path: &Path, input_text: &str, config: &Configuration) -
let printed = formatted.print()?;
printed.into_code()
}
Some("js" | "jsx" | "ts" | "tsx" | "cjs" | "mjs" | "cts" | "mts") => {
Some("js" | "jsx" | "ts" | "tsx" | "cjs" | "mjs" | "cts" | "mts" | "astro" | "svelte" | "vue") => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code below formats js files, so won't this cause errors to surface for these file types? Maybe adding a test to this PR might help demonstrate the fix?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This line below determines the JS syntax from the file path:

let Ok(syntax) = JsFileSource::try_from(file_path) else {

Which winds up here: https://github.com/biomejs/biome/blob/561b54c93625c9a83035562022af47237e6c00b2/crates/biome_js_syntax/src/file_source.rs#L300

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm down to add a test though : )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh, interesting. For adding a test it would just be adding a file like this one: https://github.com/dprint/dprint-plugin-biome/blob/main/tests/specs/Json.txt (but making the top line have a .svelte extension) then running cargo test

Copy link
Copy Markdown

@Eveeifyeve Eveeifyeve Oct 14, 2024

Choose a reason for hiding this comment

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

Also don't forget to add a thing for json and jsonc since it's fully supported in biome.
https://biomejs.dev/internals/language-support/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some("json" | "jsonc") => {

let Ok(syntax) = JsFileSource::try_from(file_path) else {
return Ok(None);
};
Expand Down
6 changes: 6 additions & 0 deletions tests/specs/Svelte.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- file.svelte --
== test svelte ==
<h1> Welcome! </h1>

[expect]
<h1>Welcome!</h1>
Loading