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

Invalid code produced when wrapping method call to new line #498

Closed
maxdeviant opened this issue Oct 3, 2019 · 0 comments
Closed

Invalid code produced when wrapping method call to new line #498

maxdeviant opened this issue Oct 3, 2019 · 0 comments

Comments

@maxdeviant
Copy link

Description

A long method call being broken up over multiple lines produces invalid F# code.

The level of indentation combined with the long method call appears to be what causes the wrapping in the first place.

This appears to be similar to/the same as #246 and #379.

Repro code

Input

module Program

[<EntryPoint>]
let main _ =
    try
        try
            Config.Logger.configure ()

            let config =
                ConfigurationBuilder()
                    .SetBasePath(Directory.GetCurrentDirectory())
                    .Build()

            WebHostBuilder()
                .UseConfiguration(config)
                .UseKestrel()
                .UseSerilog()
                .ConfigureAppConfiguration(Action<WebHostBuilderContext, IConfigurationBuilder> configureAppConfiguration)
                .ConfigureServices(Action<WebHostBuilderContext, IServiceCollection> configureServices)
                .Configure(Action<IApplicationBuilder> configureApp)
                .Build()
                .Run()
                |> ignore

            0
        with
        | ex ->
            Log.Fatal(ex, "Service terminated unexpectedly")

            1
    finally
        Log.CloseAndFlush()

Output

module Program


[<EntryPoint>]
let main _ =
    try
        try
            Config.Logger.configure()

            let config = ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).Build()

            WebHostBuilder().UseConfiguration(config).UseKestrel().UseSerilog()
                .ConfigureAppConfiguration
                (Action<WebHostBuilderContext, IConfigurationBuilder> configureAppConfiguration)
             // ^-- this appears to be what is causing the code to be invalid
                .ConfigureServices(Action<WebHostBuilderContext, IServiceCollection> configureServices)
                .Configure(Action<IApplicationBuilder> configureApp).Build().Run() |> ignore

            0
        with ex ->
            Log.Fatal(ex, "Service terminated unexpectedly")

            1
    finally
        Log.CloseAndFlush()

Repro Link

nojaf added a commit to nojaf/fantomas that referenced this issue Oct 12, 2019
nojaf added a commit that referenced this issue Oct 14, 2019
@nojaf nojaf closed this as completed Oct 14, 2019
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

No branches or pull requests

2 participants