From db9e6e4a451767b4e09c33b9a4fbbb1a70a812e1 Mon Sep 17 00:00:00 2001 From: Florian Verdonck Date: Mon, 18 Sep 2023 09:59:50 +0200 Subject: [PATCH] Process first ident in longIdent correctly. (#2960) --- CHANGELOG.md | 3 ++- src/Fantomas.Core.Tests/ModuleTests.fs | 21 +++++++++++++++++++++ src/Fantomas.Core/ASTTransformer.fs | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0fe7020e8f..f9294275ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Changelog -## [Unreleased] +## 6.2.1 - 2023-09-18 ### Fixed * Backticks in optional parameter gets removed [#2954](https://github.com/fsprojects/fantomas/issues/2954) +* Ticks in namespace are lost [#2959](https://github.com/fsprojects/fantomas/issues/2959) ## 6.2.0 - 2023-08-29 diff --git a/src/Fantomas.Core.Tests/ModuleTests.fs b/src/Fantomas.Core.Tests/ModuleTests.fs index 1f010aa035..a7e8a56892 100644 --- a/src/Fantomas.Core.Tests/ModuleTests.fs +++ b/src/Fantomas.Core.Tests/ModuleTests.fs @@ -1106,3 +1106,24 @@ module Bar = | Why | Zed """ + +[] +let ``namespace with ticks, 2959`` () = + formatSourceString + false + """ +namespace ``G-Research``.``FSharp X``.``Analyzers Y`` + +module StringAnalyzers = + () +""" + config + |> prepend newline + |> should + equal + """ +namespace ``G-Research``.``FSharp X``.``Analyzers Y`` + +module StringAnalyzers = + () +""" diff --git a/src/Fantomas.Core/ASTTransformer.fs b/src/Fantomas.Core/ASTTransformer.fs index a1b397ed7b..f8b6013d9a 100644 --- a/src/Fantomas.Core/ASTTransformer.fs +++ b/src/Fantomas.Core/ASTTransformer.fs @@ -69,7 +69,7 @@ let mkLongIdent (longIdent: LongIdent) : IdentListNode = let range = longIdent |> List.map (fun ident -> ident.idRange) |> List.reduce unionRanges - IdentListNode(IdentifierOrDot.Ident(stn head.idText head.idRange) :: rest, range) + IdentListNode(IdentifierOrDot.Ident(mkIdent head) :: rest, range) let mkSynAccess (vis: SynAccess option) = match vis with