-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Weird formatting of linq chain #1130
Comments
I think this is the same issue as #1079 |
This seems related to #1079, but this particular case did work quite a ways back. I was having a bit of trouble tracking down how exactly the regression was introduced so went back quite a few versions. This appeared in 0.26.7 and I was able I track down the source of the problem. The changes in #967 were somewhat dependant on this single line I reverted in #1074. I still need to find a solution that makes all of the updated test cases happy. Side note - running multiple versions of the playground would be nice to track down regressions like this. |
I think git bisect is what you're after: Especially since you can write a trivial test and a script to repro it, you can even have it run/find the commit automatically: |
A change was recently published that keeps method calls on same line as property access, for stuff like this (look at // Formatted with 0.27
builder.UseSerilog(
(context, logConfig) =>
logConfig
.ReadFrom.Configuration(context.Configuration)
.Enrich.FromLogContext()
.Enrich.WithExceptionDetails(
new DestructuringOptionsBuilder().WithDefaultDestructurers()
)
); (Unrelated aside: @belav I think the code above would look better if the lambda parameters were kept on the But I also noticed that in some cases CSharpier keeps the first Here's another test case taken from my project. // Formatted with 0.27
var AlternateKeys =
entityType.Keys.Count > 0
? entityType
.Keys.Select(k => new KeyTemplate
{
Name = k.DisplayName.GetDisplayName(),
ClassName = AddSuffix(k.DisplayName.GetFriendlyName("<missing key name>"), "Key"),
Fields = k.KeyAttributes.Select(f => new KeyValuePair<string, PropertyTemplate>(
f,
Properties.SingleOrDefault(x => x.LogicalName == f)
))
.ToList(),
})
.ToList()
: null; |
@shocklateboy92 thanks for the link, that would have helped make what I did a bit easier! @jods4 I happened to make changes that I believe take care of your second example. x
.CallMethod____________________________________________________________()
.CallMethod____________________________________________________________(); That logic is tweaked a bit, and results in your example like so. // Formatted with 0.27.1
var AlternateKeys =
entityType.Keys.Count > 0
? entityType
.Keys.Select(k => new KeyTemplate
{
Name = k.DisplayName.GetDisplayName(),
ClassName = AddSuffix(k.DisplayName.GetFriendlyName("<missing key name>"), "Key"),
Fields = k
.KeyAttributes.Select(f => new KeyValuePair<string, PropertyTemplate>(
f,
Properties.SingleOrDefault(x => x.LogicalName == f)
))
.ToList(),
})
.ToList()
: null; |
* Adding test case and tracking the code that caused the problem closes #1130 * Fixing regression with invocations * Fixing some edge cases * One last edge case * format file
Looks good to me! @belav Aside: |
…#1133) * Adding test case and tracking the code that caused the problem closes belav#1130 * Fixing regression with invocations * Fixing some edge cases * One last edge case * format file
Input:
Output:
Expected behavior:
The text was updated successfully, but these errors were encountered: