-
Notifications
You must be signed in to change notification settings - Fork 833
Description
Sorry if this has been discussed, planned, or documented elsewhere—please close if so. I know the use of Fantomas in this repo is relatively new, but is there a standard process for updating it? I understand the need to weigh fixing bugs against formatting churn.
Nonetheless, I think we should consider doing these:
- Update Fantomas, if possible.
- Explicitly specify more of the Fantomas settings in the repo's .editorconfig, even if we are using the default.
Why update Fantomas
As I ran into a number of times in my last couple of PRs (37142b6, e79cbbe, 83fa32c, etc.), the version of Fantomas currently used in this repo (5.0.3) has inconsistent treatment of discriminated union cases, especially in matches.
Example
@@ -1,9 +1,9 @@
-match Some (Some 123) with
-| Some (Value = Some (Value = 123)) -> ()
-| Some (Value = Some (123)) -> ()
-| Some (Some (Value = 123)) -> ()
-| Some (Value = Some (Value = x)) -> ()
-| Some (Value = x as Some (Value = y)) -> ()
+match Some(Some 123) with
+| Some(Value = Some(Value = 123)) -> ()
+| Some(Value = Some (123)) -> ()
+| Some (Some(Value = 123)) -> ()
+| Some(Value = Some (Value = x)) -> ()
+| Some(Value = x as Some (Value = y)) -> ()
| Some (Some (123)) -> ()
| Some (Some 123) -> ()
| Some (Some (x)) -> ()The current version of Fantomas (6.2.3) no longer has this problem, and the space is either always kept or always removed.
I see the following variation when I grep this codebase:
With space: A… (…
rg "\b(:?[A-Z][a-z0-9]*)+\s+\(" -tfsharp -o | measure | select count
# Count
# -----
# 26162Without space: A…(…
rg "\b(:?[A-Z][a-z0-9]*)+\(" -tfsharp -o | measure | select count
# Count
# -----
# 111287Some of that inconsistency is certainly due to the Fantomas bug, but some of the rest is likely expected (chained fluent calls, etc.).
Why specify more settings
Even though I understand the desire to use the default Fantomas settings whenever possible, and for the Fantomas defaults themselves to follow the Microsoft style guide, specifying settings like fsharp_space_before_uppercase_invocation, fsharp_space_before_member, etc., here would remove the need for contributors to consult Fantomas's docs or the style guide separately for clarity.
The Roslyn repo, for example, explicitly specifies many settings even though they use the default value.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status