Skip to content

Commit

Permalink
Process first ident in longIdent correctly. (#2960)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf authored Sep 18, 2023
1 parent c3b899d commit db9e6e4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
21 changes: 21 additions & 0 deletions src/Fantomas.Core.Tests/ModuleTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1106,3 +1106,24 @@ module Bar =
| Why
| Zed
"""

[<Test>]
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 =
()
"""
2 changes: 1 addition & 1 deletion src/Fantomas.Core/ASTTransformer.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db9e6e4

Please sign in to comment.