Skip to content

Commit 797ca48

Browse files
committed
tests for renderers
1 parent cd3799f commit 797ca48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1568
-392
lines changed

Discord.Net.ComponentDesigner.sln.DotSettings.user

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AChannelType_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F4417bfc75dcfd829be1d71df64dae93c5ffbc86c21f473aa925d1a1468fcbf_003FChannelType_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
88
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AComponentBuilderV2_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Ffce69d6f283d98656822694d183311c65bc6e862b6504f634f569e311c7564_003FComponentBuilderV2_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
99
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AComponentBuilderV2_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Ffce69d6f283d98656822694d183311c65bc6e862b6504f634f569e311c7564_003FComponentBuilderV2_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String>
10+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACSharpCompilation_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fb1a150aab7ec1c651eb1633b1e73dbc55a8bf70b7a3c8234c0dd132e333d_003FCSharpCompilation_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
1011
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADiagnostic_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3e475d18a0acfaf2be7bad235df5f96b33dfbd1220a17985ec733e54ea606a_003FDiagnostic_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
1112
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ADiagnostic_005FSimpleDiagnostic_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fec389391333ee229f2c88c579bafd0323ad3104df2de482ec8798e363e9f_003FDiagnostic_005FSimpleDiagnostic_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
1213
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEmoji_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F4a2245439d9179bf69c3b2c94e2625de532d0e329d170f468c3e4e971fcc64d_003FEmoji_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@@ -26,11 +27,14 @@
2627
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIPointerTypeSymbol_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fd4e0f3509f1eda401c2794420f23154cbbe67f861ef97db23ef66a3f4da4eb_003FIPointerTypeSymbol_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
2728
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIReadOnlyDictionary_00602_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fcdac4f3787bd4480b8be23ba23f50520d2b28_003F42_003Feba0c7b3_003FIReadOnlyDictionary_00602_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
2829
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AISymbol_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fc6a14b4226d66aee948ec182ec4b483ab2245ca70675a2daadf4c2b48ad1b_003FISymbol_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
30+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALanguageVersion_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fe1fa987e79210c9e5561b2afdb32f3359aa2ef3ecb4769b9844f45cccb77f_003FLanguageVersion_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
31+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALinePositionSpan_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F941d13827961ab7a6d882b9087f6f0604129778dfdf18ab18aa016ab26abb86e_003FLinePositionSpan_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
2932
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AList_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F1b81cb3be224213a6a73519b6e340a628d9a1fb8629c351a186a26f6376669_003FList_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3033
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ALocation_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3a2dc2a95c7ace2c0ab7946592d27726c5f34dc67bba5a72184132efc9b220_003FLocation_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3134
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMediaGalleryItemProperties_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F3adb838dc75635aa2b7b880a2e281333c653ee19bbdd186e727f23fea59d81_003FMediaGalleryItemProperties_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3235
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMessageComponent_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fe95e752d0ae334785616544f9c0e0678d9b37a82535582bb5b2ff1e44448b60_003FMessageComponent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3336
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANullable_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F5acc345db3c207bc9d886a36ff14867ef8d65557432172c2a42f19aeac04d1b_003FNullable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
37+
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANumberStyles_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fcdac4f3787bd4480b8be23ba23f50520d2b28_003F17_003F20384ea6_003FNumberStyles_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3438
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASegmentedArrayBuilder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F16bc55bbd03db0e2c0314b8d4c19f082f27156ea807d5b3cd478ba1c142fda2_003FSegmentedArrayBuilder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3539
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASelectMany_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F8c68ffb8f34ff650874cdcfee9bf343d7b3a5182a3e871fec216fe38625f4f_003FSelectMany_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3640
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASelectMenuBuilder_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fc5541d39a981b910d3b24eaa1b880639578c1c06bb1d5fdb2ddf4dfc179c61_003FSelectMenuBuilder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

src/Discord.Net.ComponentDesigner.Generator/Diagnostics.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,4 +485,15 @@ public static Diagnostic CreateParsingDiagnostic(CXDiagnostic diagnostic, Locati
485485
DiagnosticSeverity.Error,
486486
true
487487
);
488+
489+
public static readonly DiagnosticDescriptor FallbackToRuntimeValueParsing = new(
490+
"DC0054",
491+
"Using a runtime parse method",
492+
"The value may be invalid or out of range, falling back to the runtime parsing method '{0}'",
493+
"Components",
494+
DiagnosticSeverity.Warning,
495+
true
496+
);
497+
498+
488499
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
using System.Threading;
2+
using Microsoft.CodeAnalysis;
3+
using Microsoft.CodeAnalysis.CSharp;
4+
using Microsoft.CodeAnalysis.Diagnostics;
5+
6+
namespace Discord.CX;
7+
8+
public sealed record GeneratorOptions(
9+
bool EnableAutoRows = false,
10+
LanguageVersion? CSharpLangVersion = null
11+
)
12+
{
13+
public static readonly GeneratorOptions Default = new();
14+
15+
private const string ENABLE_AUTO_ROWS_KEY = "EnableAutoRows";
16+
17+
public static IncrementalValueProvider<GeneratorOptions> CreateProvider(
18+
IncrementalGeneratorInitializationContext context
19+
)
20+
{
21+
return context.CompilationProvider
22+
.Combine(context.AnalyzerConfigOptionsProvider)
23+
.Select(CreateOptions);
24+
25+
static GeneratorOptions CreateOptions(
26+
(Compilation Compilation, AnalyzerConfigOptionsProvider Options) tuple,
27+
CancellationToken token
28+
)
29+
{
30+
var compilation = tuple.Compilation;
31+
var analyzerConfig = tuple.Options;
32+
33+
LanguageVersion? langVersion = compilation is CSharpCompilation csharp
34+
? csharp.LanguageVersion
35+
: null;
36+
37+
var autoRows
38+
= analyzerConfig
39+
.GlobalOptions
40+
.TryGetValue(ENABLE_AUTO_ROWS_KEY, out var val) &&
41+
bool.TryParse(val.ToLowerInvariant(), out var bl) && bl;
42+
43+
return new GeneratorOptions(
44+
EnableAutoRows: autoRows,
45+
CSharpLangVersion: langVersion
46+
);
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)