rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

let proc-macro's provide a formatting hook for rustfmt

Open dvc94ch opened this issue 2 years ago • 1 comments

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

dvc94ch avatar Jan 10 '23 17:01 dvc94ch

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

chipnertkj avatar Sep 06 '24 13:09 chipnertkj

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?

lu-zero avatar Jan 02 '25 10:01 lu-zero