Skip to content

Commit 4aaae16

Browse files
committed
Better ValueTuple handling with expansion
1 parent 8193b5c commit 4aaae16

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Dumpify.Playground/Program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
// DumpConfig.Default.TableConfig.ShowRowSeparators = true;
1212
// DumpConfig.Default.TableConfig.ShowMemberTypes = true;
1313
// new DirectoryInfo("C:\\Program Files").Dump();
14-
//(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, "14", "15", 16, 17, 18).Dump("ValueTuple", tableConfig: new TableConfig { MaxCollectionCount = 4 });
15-
//Tuple.Create(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11)).Dump("System.Tuple");
16-
new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.Dump(tableConfig: new TableConfig { MaxCollectionCount = 3 });
14+
// (1, 2, 3, 4, ("1", "b"), 5, 6, 7, 8, 9, 10, 11, 12, 13, "14", "15", 16, 17, 18).Dump("ValueTuple", tableConfig: new TableConfig { MaxCollectionCount = 4 });
15+
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, "14", "15", 16, 17, 18).Dump("ValueTuple 1");
16+
(1, 2, 3, 4, ("1", "b"), 5, 6, 7, 8, 9, 10, 11, 12, 13, "14", "15", 16, 17, 18).Dump("ValueTuple");
17+
Tuple.Create(1, 2, 3, 4, 5, 6, 7, Tuple.Create(8, 9, 10, 11)).Dump("System.Tuple");
18+
// new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.Dump(tableConfig: new TableConfig { MaxCollectionCount = 3 });
1719
Console.WriteLine("---------------------");
1820

1921
// TestSpecific();

src/Dumpify/Renderers/Spectre.Console/TableRenderer/CustomTypeRenderers/TupleTypeRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private static IEnumerable<Type> GetGenericArgumentExpansions(Type[] genericArgu
5353
while (index < expansion.Length)
5454
{
5555
var type = expansion[index];
56-
if(IsValueTuple(type))
56+
if(0 == (index % 7) && IsValueTuple(type))
5757
{
5858
var descriptor = DumpConfig.Default.Generator.Generate(type, null, context.Config.MemberProvider)!;
5959
expansion = descriptor.Type.GetGenericArguments();

0 commit comments

Comments
 (0)