Open musjj opened 2 months ago
I'd love to have this! As you might imagine, though, it would be quite the lift.
You can also usually get some assistance from the IDE here. For example, in RustRover if you apply SQL language injection to the string literal, you can open the string in a new editor tab and do "reformat code" there.
Regarding IDE support: with neovim you can also make it work via:
conform.nvim
that then can format the blocksFound a relevant issue: https://github.com/launchbadge/sqlx/issues/2866. Re-using sqlfluff
for this would be nice, though I'm not sure how this would work.
There's also sqruff, a native Rust port of sqlfluff
made by the guys behind quary. Being written in Rust might make it easier to integrate to the CLI.
Is your feature request related to a problem? Please describe. Currently, SQL query strings can not be auto-formatted.
Describe the solution you'd like Add an auto-format command to the CLI.
Describe alternatives you've considered Format all queries manually.
Additional context As an precedence, Dioxus provides a
fmt
command in their CLI that can autoformat allrsx!
macro invocations: https://github.com/DioxusLabs/dioxus/pull/454.