rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
6.06k stars 892 forks source link

Feature: formatting other languages within rust code #6322

Closed Diggsey closed 2 months ago

Diggsey commented 2 months ago

It would be great if there was a way to extend rustfmt to format code in other languages contained within Rust source files.

For example, sqlx defines macros query!, query_as!, etc. which accept string literals containing SQL. I would like to be able to bring a SQL formatter and integrate it with rustfmt.

ytmimi commented 2 months ago

Thanks for reaching out. Similar topics have been brought up before, and at the moment the team isn't sure it makes sense to turn rustfmt into a platform to run other formatting tools.