Rider doesn't respect setting: fsharp_multi_line_lambda_closing_newline
See original GitHub issueRider version 2021.2 EAP 8 (and previous versions) doesn’t respect the fsharp_multi_line_lambda_closing_newline
formatting option from Fantomas which results in a mismatch between the formatting from Rider and the CLI tool.
My understanding is that the current EAP uses the newest version of this plugin from branch net212
and this branch is on the latest Fantomas version (4.5.0
) which I use locally.
Repro Steps
- Add .editorconfig to project
root = true
# Based on: https://github.com/G-Research/fsharp-formatting-conventions/blob/master/.editorconfig
# Difference is: disable_elmish_syntax=false and single_argument_web_mode=true
[*.fs]
fsharp_single_argument_web_mode=true
fsharp_space_before_uppercase_invocation=true
fsharp_space_before_member=true
fsharp_space_before_colon=true
fsharp_multiline_block_brackets_on_same_column=true
fsharp_newline_between_type_definition_and_members=true
fsharp_keep_if_then_in_same_line=true
fsharp_align_function_signature_to_indentation=true
fsharp_alternative_long_member_definitions=true
fsharp_disable_elmish_syntax=false
fsharp_multi_line_lambda_closing_newline=true
- Add code that contains a lambda. For example:
let x =
[ "Item"; "Item"; "Item" ]
|> List.mapi (fun i x ->
let index = i + 1
sprintf "%s: %i" x index
)
- Format it with
Ctrl+Alt+L
Expected Result
let x =
[ "Item"; "Item"; "Item" ]
|> List.mapi (fun i x ->
let index = i + 1
sprintf "%s: %i" x index
)
Actual Result
let x =
[ "Item"; "Item"; "Item" ]
|> List.mapi
(fun i x ->
let index = i + 1
sprintf "%s: %i" x index)
Repository
I have made a small repo that contains minimal code for reproducing this error: https://github.com/panmau/rider-fantomas-repro
Environment
Rider version: Rider 2021.2 EAP 8 Fantomas CLI: 4.5.0 OS: Manjaro Linux 21.1.0 Pahvo
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
F# code formatting guidelines
In case the arguments of a lambda do not fit on a single line, or are multiline themselves, put them on the next...
Read more >EditorConfig properties for C#: Line Breaks
This page lists custom JetBrains Rider EditorConfig properties that you can use to configure formatting preferences in C#, specifically, ...
Read more >Configuration
editorconfig file and will be picked up automatically by the commandline. Your IDE should respect your settings, however the implementation of that is...
Read more >C# multi-line lambda expression [duplicate]
Closed 8 years ago. I want to print a percentage value in one (or more) integer intervals. The code below describes object.ProgressChanged ...
Read more >Why Use F#? | Hacker News
In my opinion it's honestly the best statically typed general purpose programming language. f# and also Ocaml strike for me the right ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@auduchinok @DedSec256 Thank you for taking a look at this and the continued improvements regarding the integration of Fantomas in Rider. I’m looking forward to the release of the bug fix!
@panmau Thanks for such a comprehensive report!
Some settings weren’t added during recent Fantomas updates, and we currently have to do it manually during updates. It’s too late to merge a fix to 2021.2 release, but https://github.com/JetBrains/resharper-fsharp/pull/298 is going to be included in a bug fix update. The logic implemented in https://github.com/JetBrains/resharper-fsharp/pull/261 allows us not to maintain the settings list altogether, so it’ll be harder to lose a setting like this in 2021.3 and going forward.