-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
feat(fmt): literal expressions #2170
Conversation
crazy idea, maybe we can have |
@gakonst heh, thought of that as well. agree on address auto check-sum 💯 , but i'd rather leave underscores for when we implement config and make it an option there |
SGTM - just dumping thoughts |
* Make FormatBuffer handle strings The FormatBuffer automatically adds indents after newlines, so it needs to handle string based newlines and be aware that no indent should be added. Therefore the FormatBuffer tracks the state of whether or not its in a string (it also needs to track the state of whether or not its inside of a comment in order to do this) and only adds indents where necessary. Signed-off-by: Julian Popescu <hi@julian.dev>
2da7805
to
c413a54
Compare
hex"001122FF"; | ||
hex"00112233" hex"44556677"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe for follow up, this removes the _
* literal exprs * remove todo * clippy * addr literal & enum loc fix * Make FormatBuffer handle strings (foundry-rs#2225) * Make FormatBuffer handle strings The FormatBuffer automatically adds indents after newlines, so it needs to handle string based newlines and be aware that no indent should be added. Therefore the FormatBuffer tracks the state of whether or not its in a string (it also needs to track the state of whether or not its inside of a comment in order to do this) and only adds indents where necessary. Signed-off-by: Julian Popescu <hi@julian.dev> * added unicode support Co-authored-by: Julian Popescu <jpopesculian@gmail.com> Co-authored-by: Julian Popescu <hi@julian.dev>
Solution
fmt formatting of:
Expression::BoolLiteral
Expression::NumberLiteral
Expression::HexNumberLiteral
Expression::RationalNumberLiteral
Expression::StringLiteral
Expression::HexLiteral
Expression::AddressLiteral