rustfmt
rustfmt copied to clipboard
let proc-macro's provide a formatting hook for rustfmt
I'm building an app based on dioxus that uses the rsx! proc macro extensively. it's basically html with embedded rust closures. the rsx! macro even has an autoformatter [0] used by a vscode plugin. Since we can't run that in ci it would be really nice if we could somehow tell rustfmt how to format the code.
- [0] https://github.com/DioxusLabs/dioxus/tree/master/packages/autofmt
I have opened a discussion thread in the Rust Internals Forum related to this issue. If there is something constructive you could add to the discussion (criticism, possible solutions, concerns, use cases), please head through the link below. https://internals.rust-lang.org/t/discussion-adding-grammar-information-to-procedural-macros-for-proper-custom-syntax-support-in-the-toolchain/21496
The last comment in the thread sounds a fairly straightforward way to tackle it.
Does anybody see anything against the approach of offloading the macros to an external program based on configuration entries?