-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: support markup syntaxes #16
base: main
Are you sure you want to change the base?
Conversation
@@ -55,7 +55,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") => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 : )
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dprint-plugin-biome/src/format_text.rs
Line 34 in 3bdc77b
Some("json" | "jsonc") => { |
Allows downstream packages like markup_fmt pass extensions for files that use markup/frontmatter syntaxes.
Closes #15
In general, users should be able to configure the plugin to run on these files since Biome can parse/format them on its own.