fsprojects / fantomas

FSharp source code formatter
https://fsprojects.github.io/fantomas
Other
772 stars 194 forks source link

Errors after formatting secondary constructors #423

Closed auduchinok closed 5 years ago

auduchinok commented 5 years ago

Issue created from fantomas-ui

Reproduced on ProjectProperties.fs.

Code

type FSharpProjectProperties =
    inherit ProjectPropertiesBase<ManagedProjectConfiguration>

    val mutable targetPlatformData: TargetPlatformData
    val buildSettings: FSharpBuildSettings

    new(projectTypeGuids: ICollection<_>, factoryGuid, targetFrameworkIds, targetPlatformData, dotNetCoreSDK) =
        { inherit ProjectPropertiesBase<_>(projectTypeGuids, factoryGuid, targetFrameworkIds, dotNetCoreSDK)
          buildSettings = FSharpBuildSettings()
          targetPlatformData = targetPlatformData }

    new(factoryGuid, [<Optional; DefaultParameterValue(null: TargetPlatformData)>] targetPlatformData) =
        { inherit ProjectPropertiesBase<_>(factoryGuid)
          buildSettings = FSharpBuildSettings()
          targetPlatformData = targetPlatformData }

Result

type FSharpProjectProperties =
    inherit ProjectPropertiesBase<ManagedProjectConfiguration>
    val mutable targetPlatformData : TargetPlatformData
    val buildSettings : FSharpBuildSettings

    new(projectTypeGuids : ICollection<_>, factoryGuid, targetFrameworkIds,
        targetPlatformData, dotNetCoreSDK) =
        { inherit ProjectPropertiesBase<_>(projectTypeGuids, factoryGuid,
                                           targetFrameworkIds, dotNetCoreSDK); buildSettings =
                                                                                   FSharpBuildSettings
                                                                                       ()
                                                                               targetPlatformData =
                                                                                   targetPlatformData }

    new(factoryGuid,
        [<Optional; DefaultParameterValue(null : TargetPlatformData)>] targetPlatformData) =
        { inherit ProjectPropertiesBase<_>(factoryGuid); buildSettings =
                                                             FSharpBuildSettings
                                                                 ()
                                                         targetPlatformData =
                                                             targetPlatformData }

Options

Fantomas 2.9.2

Name Value
IndentSpaceNum 4
PageWidth 80
PreserveEndOfLine false
SemicolonAtEndOfLine false
SpaceBeforeArgument true
SpaceBeforeColon true
SpaceAfterComma true
SpaceAfterSemicolon true
IndentOnTryWith false
ReorderOpenDeclaration false
SpaceAroundDelimiter true
StrictMode false
jindraivanek commented 5 years ago

Unless I missing something, this is already fixed by #414. (not released)

Check out preview version of fantomas-ui here

auduchinok commented 5 years ago

@jindraivanek Yes, it's indeed fixed in the preview. I should bookmark preview instead and check it there next time. Thanks!