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

Add support for extended interpolated strings #3052

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

## [Unreleased]

### Changed
* Update FCS to 'Fix range start of INTERP_STRING_PART', commit 1da032a64321c77782e8d125afd3bf29863c3d9c [#3052](https://github.com/fsprojects/fantomas/pull/3052)

### Fixed
* Equals sign should only be on same line if last tuple is multiline. [#3040](https://github.com/fsprojects/fantomas/issues/3040)
* Return type should go on next line. [#3041](https://github.com/fsprojects/fantomas/issues/3041)
* Fantomas does not support extended interpolated strings [#3012](https://github.com/fsprojects/fantomas/issues/3012)

## 6.3.0-alpha-007 - 2024-01-27

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Some common use cases include:

<!-- Versions -->
<PropertyGroup>
<FCSCommitHash>e2496896c128ccfde33c92f45bbe0d2aa738873a</FCSCommitHash>
<FCSCommitHash>1da032a64321c77782e8d125afd3bf29863c3d9c</FCSCommitHash>
</PropertyGroup>

<PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="FSharp.Core" Version="6.0.1"/>
<PackageVersion Include="System.Collections.Immutable" Version="7.0.0" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="7.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Runtime" Version="4.3.1" />
Expand Down
4 changes: 4 additions & 0 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ pipeline "Init" {
"src/Compiler/Utilities/ResizeArray.fs"
"src/Compiler/Utilities/HashMultiMap.fsi"
"src/Compiler/Utilities/HashMultiMap.fs"
"src/Compiler/Utilities/ReadOnlySpan.fsi"
"src/Compiler/Utilities/ReadOnlySpan.fs"
"src/Compiler/Utilities/TaggedCollections.fsi"
"src/Compiler/Utilities/TaggedCollections.fs"
"src/Compiler/Utilities/illib.fsi"
Expand Down Expand Up @@ -267,6 +269,8 @@ pipeline "Init" {
"src/Compiler/Facilities/DiagnosticOptions.fs"
"src/Compiler/Facilities/DiagnosticsLogger.fsi"
"src/Compiler/Facilities/DiagnosticsLogger.fs"
"src/Compiler/Facilities/Hashing.fsi"
"src/Compiler/Facilities/Hashing.fs"
"src/Compiler/Facilities/prim-lexing.fsi"
"src/Compiler/Facilities/prim-lexing.fs"
"src/Compiler/Facilities/prim-parsing.fsi"
Expand Down
12 changes: 7 additions & 5 deletions src/Fantomas.Benchmarks/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,6 @@
"resolved": "5.0.0",
"contentHash": "JPJArwA1kdj8qDAkY2XGjSWoYnqiM7q/3yRNkt6n28Mnn95MuEGkZXUbPBf7qc3IjwrGY5ttQon7yqHZyQJmOQ=="
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
},
"System.Management": {
"type": "Transitive",
"resolved": "5.0.0",
Expand Down Expand Up @@ -287,11 +282,18 @@
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
"System.Runtime": "[4.3.1, )"
}
},
"System.Collections.Immutable": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
Expand Down
11 changes: 6 additions & 5 deletions src/Fantomas.Client.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,6 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
},
"System.Diagnostics.Debug": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -798,6 +793,12 @@
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"System.Collections.Immutable": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
Expand Down
17 changes: 9 additions & 8 deletions src/Fantomas.Client/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,6 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
"dependencies": {
"System.Memory": "4.5.4"
}
},
"System.Diagnostics.Debug": {
"type": "Transitive",
"resolved": "4.3.0",
Expand Down Expand Up @@ -838,6 +830,15 @@
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
},
"System.Collections.Immutable": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
"dependencies": {
"System.Memory": "4.5.4"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
Expand Down
28 changes: 28 additions & 0 deletions src/Fantomas.Core.Tests/InterpolatedStringTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,31 @@ let ``very long triple-quoted strings do not cause the interpolated string activ
$"let value =
\"\"\"%s{loremIpsum}\"\"\"
"

[<Test>]
let ``don't eat braces, 3012`` () =
formatSourceString
"
$$$\"\"\"{{{5}}}\"\"\"
"
config
|> prepend newline
|> should
equal
"
$$$\"\"\"{{{5}}}\"\"\"
"

[<Test>]
let ``extended interpolated string with several fill expressions`` () =
formatSourceString
"
let x = $$$\"\"\"one {{{1}}} two {{{2}}} three {{{3}}}\"\"\"
"
config
|> prepend newline
|> should
equal
"
let x = $$$\"\"\"one {{{1}}} two {{{2}}} three {{{3}}}\"\"\"
"
7 changes: 7 additions & 0 deletions src/Fantomas.Core.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,18 @@
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
"System.Runtime": "[4.3.1, )"
}
},
"System.Collections.Immutable": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
Expand Down
11 changes: 11 additions & 0 deletions src/Fantomas.Core/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,22 @@
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
"System.Runtime": "[4.3.1, )"
}
},
"System.Collections.Immutable": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==",
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
Expand Down
13 changes: 13 additions & 0 deletions src/Fantomas.FCS/Fantomas.FCS.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\HashMultiMap.fs">
<Link>Utilities\HashMultiMap.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\ReadOnlySpan.fsi">
<Link>Utilities\HashMultiMap.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\ReadOnlySpan.fs">
<Link>Utilities\HashMultiMap.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Utilities\TaggedCollections.fsi">
<Link>Utilities\TaggedCollections.fsi</Link>
</Compile>
Expand Down Expand Up @@ -143,6 +149,12 @@
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\DiagnosticsLogger.fs">
<Link>Facilities\DiagnosticsLogger.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\Hashing.fsi">
<Link>Facilities\Hashing.fsi</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\Hashing.fs">
<Link>Facilities\Hashing.fs</Link>
</Compile>
<Compile Include="..\..\.deps\$(FCSCommitHash)\src\Compiler\Facilities\prim-lexing.fsi">
<Link>Facilities\prim-lexing.fsi</Link>
</Compile>
Expand Down Expand Up @@ -304,6 +316,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" />
<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Runtime" />
Expand Down
10 changes: 10 additions & 0 deletions src/Fantomas.FCS/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"System.Collections.Immutable": {
"type": "Direct",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==",
"dependencies": {
"System.Memory": "4.5.5",
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "Direct",
"requested": "[7.0.0, )",
Expand Down
12 changes: 7 additions & 5 deletions src/Fantomas.Tests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,6 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
},
"System.Configuration.ConfigurationManager": {
"type": "Transitive",
"resolved": "4.4.0",
Expand Down Expand Up @@ -864,6 +859,7 @@
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
"System.Runtime": "[4.3.1, )"
Expand Down Expand Up @@ -952,6 +948,12 @@
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"System.Collections.Immutable": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ=="
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
Expand Down
15 changes: 10 additions & 5 deletions src/Fantomas/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -415,11 +415,6 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.Collections.Immutable": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g=="
},
"System.Configuration.ConfigurationManager": {
"type": "Transitive",
"resolved": "4.4.0",
Expand Down Expand Up @@ -916,6 +911,7 @@
"type": "Project",
"dependencies": {
"FSharp.Core": "[6.0.1, )",
"System.Collections.Immutable": "[7.0.0, )",
"System.Diagnostics.DiagnosticSource": "[7.0.0, )",
"System.Memory": "[4.5.5, )",
"System.Runtime": "[4.3.1, )"
Expand All @@ -927,6 +923,15 @@
"resolved": "2.0.2",
"contentHash": "4EQgYdNZ92SyaO7YFk6olVnebF5V+jrHyMUjvPq89tLeMo8NSfgDF+6Zwq/lgh9j/0yfQp9Lkm0ZA0rUATCZFA=="
},
"System.Collections.Immutable": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
"resolved": "7.0.0",
"contentHash": "dQPcs0U1IKnBdRDBkrCTi1FoajSTBzLcVTpjO4MBCMC7f4pDOIPzgBoX8JjG7X6uZRJ8EBxsi8+DR1JuwjnzOQ==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
}
},
"System.Diagnostics.DiagnosticSource": {
"type": "CentralTransitive",
"requested": "[7.0.0, )",
Expand Down
Loading