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

Process first ident in longIdent correctly. #2960

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
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