Remove prettier style method chaining
I was experimenting with method chaining, and noticed that by removing GroupPrintedNodesPrettierStyle and only using GroupPrintedNodesOnLines formatting improved in my opinion.
Specifically this fixes #1298 and didn't seem to have any significant negative effects.
This seems a bit too easy, I'm sure there's a reason for the existing setup. But I thought I'd bring it up at least.
I ran it on all of this code - https://github.com/belav/csharpier-repos/pull/113/files - to see some real world examples.
I think the first change in there is why this code sticks around. I believe there is a lot of EF or aspnetcore code that has a lot of Property.CallMethod().Property.CallMethod() type chains.
// current
httpResponseException = aggregateException
.Flatten()
.InnerExceptions.Select(ExtractHttpResponseException)
.Where(ex => ex != null && ex.Response != null)
.OrderByDescending(ex => ex.Response.StatusCode)
.FirstOrDefault();
// this PR
httpResponseException = aggregateException
.Flatten()
.InnerExceptions
.Select(ExtractHttpResponseException)
.Where(ex => ex != null && ex.Response != null)
.OrderByDescending(ex => ex.Response.StatusCode)
.FirstOrDefault();
I do have a ticket somewhere, to prefer keeping method calls together. Which this does kind of accomplish. Perhap the logic for when to use the prettier style grouping just needs to be adjusted.
// current
IExtensibleModelBinder childBinder = bindingContext.ModelBinderProviders.GetBinder(
controllerContext,
innerBindingContext
);
// this pr
IExtensibleModelBinder childBinder = bindingContext
.ModelBinderProviders
.GetBinder(controllerContext, innerBindingContext);
// maybe should try to keep properties together like this
IExtensibleModelBinder childBinder = bindingContext.ModelBinderProviders
.GetBinder(controllerContext, innerBindingContext);
Thank you for the feedback!
I looked into writing chaining in a way that covers all cases but couldn't come up with anything I was satisfied with.
Closing this for the reasons outlined above.