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

Remove MaxDotGetExpressionWidth #3138

Merged

Conversation

nojaf
Copy link
Contributor

@nojaf nojaf commented Nov 26, 2024

As we prepare for a major version update to support F# 9, I would like to propose the removal of the MaxDotGetExpressionWidth setting.

Description

This setting controls the maximum width for which nested SynExpr.DotGet expressions can remain on a single line.

Key Reasons for Removal:

  • Since the introduction of the Chain AST node, this setting has become somewhat awkward and inconsistent.
  • I am unaware of any users who actively utilize this setting; most people do not even know of its existence.
  • In hindsight, I regret adding this as a configurable option, as there was no significant demand for it. The community's focus was on resolving the original problem, which has been addressed and remains so after the removal of this setting.
  • This is one less setting to maintain, little things like this keep the lights on a bit longer.

@dawedawe, @josh-degraw & @Smaug123 (or @pleaseletmesearch) please let me know if you are on board with this.

@Smaug123
Copy link
Contributor

Yes, this seems reasonable! Thanks.

@nojaf nojaf merged commit df13126 into fsprojects:v7.0 Nov 29, 2024
5 checks passed
nojaf added a commit that referenced this pull request Jan 10, 2025
* Remove MaxDotGetExpressionWidth

* Fix remaining tests
@JimAlexBerger
Copy link

After upgrading to fantomas 7.0.0 we can see this affecting our formatting.
It looks like this was changed from previously having a default value of 80 to now follow the max_line_length config value.

We found it very pleasing and readable having these on separate lines.
I know its not fantomas job to cater to everyone personal preference, but we were wondering if there has been a change in the style guideline to now change the default away from 80 and this change was intended.

Here is a sample from our code base, among many, that were affected by this change.

Before:

module NormalizedPersistenceId =
        let replaceNationalCharacters (text: string) =
            text
                .Replace("æ", "ae")
                .Replace("ø", "oe")
                .Replace("å", "aa")
                .Replace("Æ", "AE")
                .Replace("Ø", "OE")
                .Replace("Å", "AA")

After (we have a bit of an increased max_line_length of 160):

module NormalizedPersistenceId =
    let replaceNationalCharacters (text: string) =
        text.Replace("æ", "ae").Replace("ø", "oe").Replace("å", "aa").Replace("Æ", "AE").Replace("Ø", "OE").Replace("Å", "AA")

@nojaf
Copy link
Contributor Author

nojaf commented Jan 15, 2025

I know its not fantomas job to cater to everyone personal preference, but we were wondering if there has been a change in the style guideline to now change the default away from 80 and this change was intended.

This setting predates the style guide, so it was never compliant with the style guide to begin with.

The change in behavior is a logical consequence of the removal of this setting.

While this may not be the answer you're looking for, you could add // after the first ) to enable multiline mode.

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.

5 participants