Skip to content

Commit

Permalink
Keep parenthesis on the same for App inside multiline DotGet thing (#…
Browse files Browse the repository at this point in the history
…1015)

* Keep parenthesis on the same for App inside multiline DotGet thing. Fixes #862.

* Same fix but for tuples. Fixes #842.
  • Loading branch information
nojaf committed Aug 19, 2020
1 parent e652e7b commit 17fa4cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Fantomas.Tests/LongIdentWithDotsTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ let main _ =
ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).Build()
WebHostBuilder().UseConfiguration(config).UseKestrel().UseSerilog()
.ConfigureAppConfiguration
(Action<WebHostBuilderContext, IConfigurationBuilder> configureAppConfiguration)
.ConfigureAppConfiguration(Action<WebHostBuilderContext, IConfigurationBuilder>
configureAppConfiguration)
.ConfigureServices(Action<WebHostBuilderContext, IServiceCollection> configureServices)
.Configure(Action<IApplicationBuilder> configureApp).Build().Run()
|> ignore
Expand Down
5 changes: 2 additions & 3 deletions src/Fantomas.Tests/OperatorTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ let ``should break on . operator and keep indentation``() =
""" { config with MaxLineLength = 80; MaxInfixOperatorExpression = 60 }
|> should equal """let pattern =
(x + y)
.Replace
(seperator + "**" + seperator,
replacementSeparator + "(.|?" + replacementSeparator + ")?")
.Replace(seperator + "**" + seperator,
replacementSeparator + "(.|?" + replacementSeparator + ")?")
.Replace("**" + seperator, ".|(?<=^|" + replacementSeparator + ")")
"""
Expand Down
3 changes: 3 additions & 0 deletions src/Fantomas/CodePrinter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,9 @@ and genExpr astContext synExpr =
let genMultilineExpr =
match e with
| Paren(Lambda(_)) -> atCurrentColumnIndent(genExpr astContext e)
| Paren(App(_))
| Paren(Tuple(_)) ->
atCurrentColumn(genExpr astContext e)
| _ ->
ifElse hasParenthesis
(indent +> sepNln +> genExpr astContext e +> unindent)
Expand Down

0 comments on commit 17fa4cb

Please sign in to comment.