-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
Improve formatting #501
Comments
The thing I'm missing somewhat here is when not to stack them on multiple lines. let foo = Host.CreateDefaultBuilder(args) As this is short, I'd leave this as it is.
|
An extra setting would be the most flexible solution, similar to e.g. |
How about |
Sure, that works. Could also consider a name containing |
The lack of this functionality is my only major issue with Fantomas as it stands today. It would be great if we could have something implemented for this.
Thank you very much for all the great work being done.... |
I've pushed the first alpha with support for this issue at https://www.nuget.org/packages/fantomas-tool/4.2.0-alpha-001. |
Looks good for the most part, but this fails: Original and expected: let firstName =
define
.Attribute
.ParsedRes(FirstName.value, FirstName.create)
.Get(fun u -> u.FirstName)
.SetRes(userSetter User.setFirstName) Actual (notice let firstName =
define
.Attribute.ParsedRes(FirstName.value, FirstName.create)
.Get(fun u -> u.FirstName)
.SetRes(userSetter User.setFirstName)
Compiles, but the formatting is incorrect. IMHO it should chop either no lines or all lines, to preserve the symmetry. |
Published alpha-002 that tackles this example. |
I can't reopen, but something is still not right. Function bodies are not always indented correctly: Original and expected: let getColl =
define
.Operation
.ForContext(Context.toAuthenticatedContext)
.GetCollection(fun _ parser ->
let x = 2
x) Actual: let getColl =
define
.Operation
.ForContext(Context.toAuthenticatedContext)
.GetCollection(fun _ parser ->
let x = 2
x) By the way, you may consider indenting function bodies either relative to |
Published alpha 003, let me know if I need to reopen this. |
Looks good, thank you so much! |
(Sorry for the non-descriptive title)
Description
The following is hand-crafted, and I find it aesthetically pleasing and tidy:
Here is how Fantomas formats it, which I find rather messy:
There are several issues here:
Host
being aligned the way they are. IfHost
had a much longer name, all the interesting code would be pushed far to the right, leaving little space and yielding many unneeded line breaks.ConfigureWebHostDefaults
is indented on the same level as the line above. It should be indented an additional level.UseStartup<Startup>
with theunit
arg being on the next line.Build()
and.Run()
should be on the same level as the other fluent calls toHost
Repro code
Online (on my PC the line width it set to 120 when clicking the link; I made it with 80, so that's probably another bug)
The text was updated successfully, but these errors were encountered: