You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I haven't been able to find this in the issue tracker. If it is there, sorry for missing it!
On IRC, someone wanted to auto-format a big match-like macro, like:
match_any_type!(var, {Foo::A => a,
Foo::B => {
bar();
b
}// etc.})
The use case appears to make sense to me, but I don't think any rust formatting tool is currently able to handle this, as it is completely macro-dependent.
Mutabah | [snip] Re getting auto-formatting of macro input - I don't know if there's formatting tools that can do that... a
| powerful one could possibly look at the macro signature and guess at formatting for fragements
IOW, rustfmt could (theoretically) check the macro signature and figure out what parts are of what type, to then try to indent them correctly.
I don't know if this is actually doable within reasonable complexity, but thought this idea was great and deserved to be tracked :)
Anyway, thank you for your work on rustfmt!
The text was updated successfully, but these errors were encountered:
For what it's worth, Rustfmt already tries to format arguments to macros if they look like normal expressions.
So while the example above wouldn't be currently auto-formatted, macro author could change it to accept syntax that looks like actual match expression:
match_any_type!(match var {Foo::A => a,
Foo::B => {
bar();
b
}// etc.})
Hello,
I haven't been able to find this in the issue tracker. If it is there, sorry for missing it!
On IRC, someone wanted to auto-format a big match-like macro, like:
The use case appears to make sense to me, but I don't think any rust formatting tool is currently able to handle this, as it is completely macro-dependent.
However, @thepowersgang proposed a solution:
IOW, rustfmt could (theoretically) check the macro signature and figure out what parts are of what type, to then try to indent them correctly.
I don't know if this is actually doable within reasonable complexity, but thought this idea was great and deserved to be tracked :)
Anyway, thank you for your work on rustfmt!
The text was updated successfully, but these errors were encountered: