Skip to content
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

Autoformat sqlx macros #3517

Open
musjj opened this issue Sep 21, 2024 · 4 comments
Open

Autoformat sqlx macros #3517

musjj opened this issue Sep 21, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@musjj
Copy link

musjj commented Sep 21, 2024

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 all rsx! macro invocations: DioxusLabs/dioxus#454.

@musjj musjj added the enhancement New feature or request label Sep 21, 2024
@abonander
Copy link
Collaborator

I'd love to have this! As you might imagine, though, it would be quite the lift.

@abonander
Copy link
Collaborator

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.

@syphar
Copy link

syphar commented Sep 22, 2024

Regarding IDE support:
with neovim you can also make it work via:

@musjj
Copy link
Author

musjj commented Sep 22, 2024

Found a relevant issue: #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants