-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Adding formatting for spread element #1179
Conversation
@jods4 I went with a space after the operator because that is what is in all the official docs int[] someArray = [.. list]; There were only two instances of spread in here - belav/csharpier-repos#104 - or at least only two that changed formatting. I'm going to update the code there and then do some proper querying to see how the spread operator has been used so far. I'm open to either space or no space. JS/TS is no space as far as I know. edit - just 10 instances in all the csharpier-repos, and they all use |
@belav I wrote my example without a space after Most important is that you've fixed the blind spot in formatting the spreaded value! 👍 |
As already mentioned due to how the spread element/operator is used without an additional space in at least JS/TS the option without space would feel more "natural" to me, especially when switching between languages often. The official documentation is also a bit inconsistent here where in its explanatory text it doesn't use spaces either ("The spread element Would be happy if this could be reconsidered. |
Excuses to respond to an older PR. I came to this repo to report (or ask to remove) the space between the spread operator and the operand. This just looks weird: internal class Test
{
private static readonly int[] Array = [1, 2, 3];
private static void Main()
{
int[] _ =
[
.. Test.Array,
.. Test.Array,
.. Test.Array,
.. Test.Array,
.. Test.Array,
.. Test.Array,
];
}
} Me too, am familiar with JS syntax, but then again, the spread operator in JS uses three dots anyways. But, after reading dotnet/roslyn#72863 & dotnet/roslyn#71219 it appears that the space is intentional.
TIL |
closes #1167