Skip to content
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

Fix ugly line breaks in curly braces outside of page margin when using SciMLStyle with yas_style_nesting=true #785

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

efaulhaber
Copy link
Contributor

On master, this

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx::SomePrettyLongTypeName{Foo}

will be reformatted to this:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx::SomePrettyLongTypeName{
                                                                                            Foo
                                                                                            }

I modified p_curly of YASStyle to not always insert a Placeholder(0) but add a Placeholder(1) when whitespace_typedefs=true. This is identical to what is done in DefaultStyle. With this change, I can use p_curly of YASStyle for SciMLStyle as well when yas_style_nesting=true.

Here is a demonstration of what happens in a large project when reformatted with this PR:
trixi-framework/Trixi.jl#1759

IMHO, many things get prettier, and everything else gets, well, at least not uglier ¯\_(ツ)_/¯
The only thing that gets slightly worse IMO is the file src/solvers/dgmulti/sbp.jl, but that wasn't pretty to begin with.

@domluna
Copy link
Owner

domluna commented Nov 29, 2023

this looks good to me. seems ready to merge anything else you want to add?

@efaulhaber
Copy link
Contributor Author

Ready to merge from my side.

@domluna domluna merged commit a4ec84f into domluna:master Nov 29, 2023
56 checks passed
@efaulhaber efaulhaber deleted the fix-sciml-curly branch November 29, 2023 13:26
@efaulhaber
Copy link
Contributor Author

Thanks! When do you expect the next release?

@hyrodium
Copy link
Contributor

v1.0.43 is going to be registered, but is failing automerge.
JuliaRegistries/General#96136

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.

None yet

3 participants