Code Style: spaces within C# tuple parentheses
I'm looking for a Code Style or .editorconfig setting for formatting C# tuples in the following way:
With spaces within parentheses:
public ( int x, int y ) Field;
public void Func( ( int x, int y ) FuncParam, List<( int x, int y )> FuncListParam )
{
}Without spaces within parentheses:
public (int x, int y) Field;
public void Func( (int x, int y) FuncParam, List<(int x, int y)> FuncListParam )
{
}I haven't been able to find one. As a close "peer", when deconstructing KeyValuePair<TKey, TValue>, it does get those spaces there within parentheses with my current style config.
var map = new Dictionary<int, int>();
foreach ( ( int x, int y ) in map )
{
}Any help? Or a possible feature request? I'm using Rider 2023.3.2, Build #RD-233.13135.100
Please sign in to leave a comment.
Hello,
Could you please share what is the expected code sample you'd like to get with the formatting? You can also select this code sample in Rider and run Alt+Enter | Reformat and cleanup | Detect code style settings to check what Rider settings will be available for you.
Please let me know how it goes.
Thank you.
Hi,
In the original post I just shared that expected code sample regarding what I'm hoping you would provide a code style setting for.
And yes I'm aware of the Detect code style settings, but it doesn't detect anything there.
Hello,
please try the following .editorconfig setting - https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options#csharp_space_between_parentheses
Hello,
yes I have
csharp_space_between_parenthesesset tocontrol_flow_statements,expressionsin my.editorconfigfile, but it doesn't affect that above tuple-case.Hi,
Sorry for a delay in responding.
I've filed a corresponding feature request - Add an option to set a space between parentheses. Please feel free add your considerations and suggestions there.
Thank you.