Skip to content

Conversation

@fvictorio
Copy link
Member

Closes #391

This PR prevents prettier from joining multi-part strings and hex literals. It also prints each one in a separate line when the line is too long.

@codecov
Copy link

codecov bot commented Nov 19, 2020

Codecov Report

Merging #393 (1d7b1af) into master (33368a1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #393   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          90       90           
  Lines         731      736    +5     
  Branches      140      140           
=======================================
+ Hits          729      734    +5     
  Misses          2        2           
Impacted Files Coverage Δ
src/nodes/HexLiteral.js 100.00% <100.00%> (ø)
src/nodes/StringLiteral.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33368a1...a737175. Read the comment docs.

Copy link
Member

@mattiaerre mattiaerre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +15 to +28
contract MultipartStrings {
bytes b1 = hex"beef";
bytes b2 = hex"beef";
bytes b3 = hex"beef" hex"c0ffee";
bytes b4 =
hex"beeeeeeeeeeeeeeeeeeeeeef"
hex"c0000000000ffeeeeeeeeeeeeeeeeeee";

string s1 = "foo";
string s2 = "foo" "bar";
string s3 =
"foofoofoofooofoofoofofoooofofoo"
"barbarbrabrbarbarbabrabrbabr";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice 👍

@junderw
Copy link

junderw commented Nov 19, 2020

LGTM!!! Can't wait to clean up some contracts!

@junderw
Copy link

junderw commented Nov 19, 2020

Also in semi-related issues to allow for multiline hex literals output by this new formatter:

sc-forks/solidity-coverage#575

protofire/solhint#273

@fvictorio
Copy link
Member Author

@junderw they just need to update the parser to the latest version :)

@fvictorio fvictorio merged commit f7dbedf into master Nov 19, 2020
@fvictorio fvictorio deleted the multi-part-literals branch November 19, 2020 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Suggestion] Don't join string literals that are split

4 participants