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 idempotency problem with multiline quotation expressions. #2211

Merged
merged 3 commits into from
May 4, 2022

Conversation

dawedawe
Copy link
Member

Fixes #2203
I used a slightly different fix to be more in line with what we do sofar.
Mainly to not put the <@ on separate lines.

Extend Quote handling with expressionFitsOnRestOfLine.
@dawedawe dawedawe changed the title Fix idempotency problem with multiline quotation expressions, 2203. Fix idempotency problem with multiline quotation expressions. Apr 26, 2022
Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

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

The code looks good, I would like to see the input from the style guide first.

equal
"""
let action =
<@ let msg = %httpRequestMessageWithPayload
Copy link
Contributor

Choose a reason for hiding this comment

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

I can understand your reasoning behind the change.
However, this leads to the following problem.

I won't deny that there are other places where Fantomas has this problem.
The point is that there are different ways of looking at this.

If it is ok with you I'd like you to bring it up with the F# style guide over at https://github.com/fsharp/fslang-design#style-guide? That would be interesting for you to see that process as well.
Once there is an outcome there, it can be picked up in the style guide and we can respect the outcome in Fantomas.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. To speed things up it might be good to include a proposal in the raised issue.
So if I understand you correctly, you prefer to have <@/@> on separate lines for multi line expressions, right?
Given your example, I think there is a good argument for that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I prefer it mainly because of the technical impact on Fantomas side.
Things are more straightforward if we can keep a multitude of the indent_size.
But I don't have the strongest opinion as I've never really used a quotation before.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here we go.

Copy link
Contributor

@nojaf nojaf left a comment

Choose a reason for hiding this comment

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

This looks very good, well done!

@nojaf nojaf merged commit 0e036ac into fsprojects:master May 4, 2022
@dawedawe dawedawe deleted the fix-2203 branch May 4, 2022 06:38
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.

Idempotency problem when formatting quotations
2 participants