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 issues with multiline generic type parameters #2852

Merged
merged 17 commits into from
Jan 9, 2024
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 6.3.0-alpha-006 - 2024-01-09

### Changed
* Aligned bracket style in anonymous record is not respected. [#2706](https://github.com/fsprojects/fantomas/issues/2706) [style guide](https://github.com/fsharp/fslang-design/issues/756)

## 6.3.0-alpha-005 - 2023-12-22

### Changed
Expand Down
6 changes: 4 additions & 2 deletions src/Fantomas.Core.Tests/ClassTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,10 @@ module rec Xterm
[<AllowNullLiteral>]
type Terminal =
abstract onKey:
IEvent<{| key: string
domEvent: KeyboardEvent |}> with get, set
IEvent<
{| key: string
domEvent: KeyboardEvent |}
> with get, set

abstract onLineFeed: IEvent<unit> with get, set
"""
Expand Down
1 change: 1 addition & 0 deletions src/Fantomas.Core.Tests/CodeFormatterTests.fs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module Fantomas.Core.Tests.CodeFormatterTests

open Fantomas.Core.SyntaxOak
open NUnit.Framework
open Fantomas.FCS.Text
open Fantomas.Core
Expand Down
13 changes: 8 additions & 5 deletions src/Fantomas.Core.Tests/DallasTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1515,11 +1515,14 @@ let autoCompleteItems: cmap<DeclName, DeclarationListItem * Position * string<Lo
equal
"""
let autoCompleteItems
: cmap<DeclName, DeclarationListItem *
Position *
string<LocalPath> *
(Position -> option<string>) *
FSharp.Compiler.Syntax.ParsedInput> =
: cmap<
DeclName,
Copy link
Contributor

Choose a reason for hiding this comment

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

This indent no longer is a multitude of the indent_size, we should look into why this is happening. Gut feeling this is related due to

+> atCurrentColumnIndent (genType rt.Type)
and not the changes here.
Nonetheless, we should investigate this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you still consider this a problem or are we okay with this indent level?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I think I can live with this.
This sample screams "use type alias" anyway.

DeclarationListItem *
Position *
string<LocalPath> *
(Position -> option<string>) *
FSharp.Compiler.Syntax.ParsedInput
> =
cmap ()
"""

Expand Down
2 changes: 1 addition & 1 deletion src/Fantomas.Core.Tests/LetBindingTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,7 @@ module PoorlyIndented =
select name
from things
where id = :id
" >
" >
dependency

cmd.AsyncExecute(id = thingId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,10 @@ let ``multiline abstract member without constraints, 2175`` () =
type FuseSortFunctionItem =
abstract Item:
key: string ->
U2<{| ``$``: string |}, ResizeArray<{| ``$``:
string
idx:
float |}>> with get, set
U2<
{| ``$``: string |},
ResizeArray<{| ``$``: string; idx: float |}>
> with get, set

abstract X: int
"""
11 changes: 8 additions & 3 deletions src/Fantomas.Core.Tests/SignatureTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,9 +1554,14 @@ namespace Foo
type Bar =
member Hello :
thing :
XLongLongLongLongLongLongLongLong<bool -> 'a, bool -> 'b, bool -> 'c, bool -> 'd, bool -> ('e -> 'f) -> 'g, ('h
-> 'i)
-> 'j> *
XLongLongLongLongLongLongLongLong<
bool -> 'a,
bool -> 'b,
bool -> 'c,
bool -> 'd,
bool -> ('e -> 'f) -> 'g,
('h -> 'i) -> 'j
> *
item : int list ->
LongLongLongLongLongLongLongLongLongLongLongLongLongLongLongLong
"""
Expand Down
Loading