csharpier
csharpier copied to clipboard
Spread (in collection expression) are not formatted
Input:
List<KeyValuePair<string, string>> list =
[.. attribute.Targets.Select(target => KeyValuePair.Create(target, context.EntityDefinitions.TryGetValue(target, out var type) ? type.ClassName : null)).Where(kvp => kvp.Value != null)];
Output:
List<KeyValuePair<string, string>> list =
[
.. attribute.Targets.Select(target => KeyValuePair.Create(target, context.EntityDefinitions.TryGetValue(target, out var type) ? type.ClassName : null)).Where(kvp => kvp.Value != null)
];
Expected behavior:
The spread doesn't seem to be formatted at all.
For example, extra spaces after the .. or after => are not condensed.
The line is extremely long but it's not broken.
I would expect something like
List<KeyValuePair<string, string>> list =
[
..attribute
.Targets.Select(target =>
KeyValuePair.Create(
target,
context.EntityDefinitions.TryGetValue(target, out var type) ? type.ClassName : null
)
)
.Where(kvp => kvp.Value != null)
];