-
Notifications
You must be signed in to change notification settings - Fork 493
Add New Enum Description Converter #3137
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
base: main
Are you sure you want to change the base?
Changes from 21 commits
db71c82
64a31a4
ee49e0f
2b2d254
17ecc76
eb5927b
745cfc3
6384d8a
7cf4bf7
94edbf7
1ff4d6a
120e642
121742e
d0afca0
f18eff0
295496b
150791c
28304c1
4f21f71
6e4e5ba
dd4d8f4
012182e
0c6f83f
5413fef
69b243c
3a012cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,8 +32,7 @@ | |
| <WindowsSdkPackageVersion>10.0.19041.56</WindowsSdkPackageVersion> | ||
| </PropertyGroup> | ||
|
|
||
| <PropertyGroup Condition="'$(Configuration)' == 'Release' | ||
| AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'"> | ||
| <PropertyGroup Condition="'$(Configuration)' == 'Release'
 AND $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) != 'windows'"> | ||
| <!-- Windows error NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. --> | ||
| <PublishAot>false</PublishAot> | ||
| <PublishTrimmed>true</PublishTrimmed> | ||
|
|
@@ -87,6 +86,18 @@ | |
| <ProjectReference Include="..\..\src\CommunityToolkit.Maui.Maps\CommunityToolkit.Maui.Maps.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you revert those changes? |
||
| <Compile Update="Pages\Converters\EnumDescriptionConverterPage.xaml.cs"> | ||
| <DependentUpon>EnumDescriptionConverterPage.xaml</DependentUpon> | ||
| </Compile> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <MauiXaml Update="Pages\Converters\EnumDescriptionConverterPage.xaml"> | ||
| <Generator>MSBuild:Compile</Generator> | ||
| </MauiXaml> | ||
| </ItemGroup> | ||
|
|
||
| <PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))=='windows' and $(Configuration) == 'Release'"> | ||
| <RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
| </PropertyGroup> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| <?xml version="1.0" encoding="utf-8" ?> | ||
| <pages:BasePage | ||
| x:Class="CommunityToolkit.Maui.Sample.Pages.Converters.EnumDescriptionConverterPage" | ||
| xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages" | ||
| xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" | ||
| xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.Converters" | ||
| Title="EnumDescriptionConverter" | ||
| x:DataType="vm:EnumDescriptionConverterViewModel" | ||
| x:TypeArguments="vm:EnumDescriptionConverterViewModel"> | ||
|
|
||
| <pages:BasePage.Resources> | ||
| <ResourceDictionary> | ||
| <toolkit:EnumDescriptionConverter x:Key="EnumDescriptionConverter" /> | ||
| </ResourceDictionary> | ||
| </pages:BasePage.Resources> | ||
|
|
||
| <pages:BasePage.Content> | ||
| <VerticalStackLayout Padding="20" Spacing="20"> | ||
| <Label VerticalOptions="Center"> | ||
| <Label.FormattedText> | ||
| <FormattedString> | ||
| <Span Text="The" /> | ||
| <Span FontAttributes="Bold" Text=" EnumDescriptionConverter " /> | ||
| <Span Text="converts Enum values into readable text so they display nicely in the UI." /> | ||
| </FormattedString> | ||
| </Label.FormattedText> | ||
| </Label> | ||
| <Label Text="When an Enum value is passed in, the converter looks for attributes that provide a more user-friendly name. If one is found, it uses that value; otherwise it simply uses the Enum’s name.. " VerticalOptions="Center" /> | ||
TheCodeTraveler marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <Label Text="This ensures that Enum values can be displayed clearly while still working correctly even when no attributes are defined. " VerticalOptions="Center" /> | ||
| <Label Text="There is no description needed for one word enum members that are spelled the way you want to display them." /> | ||
|
|
||
|
|
||
| <Border | ||
| Margin="0,20,0,0" | ||
| Padding="15,10" | ||
| Background="LightGray" | ||
| StrokeShape="RoundRectangle 8"> | ||
| <HorizontalStackLayout Spacing="10"> | ||
| <Label | ||
| FontSize="16" | ||
| Text="Without Converter:" | ||
| TextColor="DarkRed" /> | ||
| <Label | ||
| FontAttributes="Bold" | ||
| FontSize="16" | ||
| Text="{Binding SelectedMode}" | ||
| TextColor="DarkRed" /> | ||
| </HorizontalStackLayout> | ||
| </Border> | ||
| <Border | ||
| Padding="15,10" | ||
| Background="LightGray" | ||
| StrokeShape="RoundRectangle 8"> | ||
| <HorizontalStackLayout Spacing="10"> | ||
| <Label | ||
| FontSize="16" | ||
| Text="With Converter:" | ||
| TextColor="DarkRed" /> | ||
| <Label | ||
| FontAttributes="Bold" | ||
| FontSize="16" | ||
| Text="{Binding SelectedMode, Converter={StaticResource EnumDescriptionConverter}}" | ||
| TextColor="DarkRed" /> | ||
| </HorizontalStackLayout> | ||
| </Border> | ||
| </VerticalStackLayout> | ||
| </pages:BasePage.Content> | ||
| </pages:BasePage> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| using CommunityToolkit.Maui.Sample.ViewModels.Converters; | ||
|
|
||
| namespace CommunityToolkit.Maui.Sample.Pages.Converters; | ||
|
|
||
| public partial class EnumDescriptionConverterPage : BasePage<EnumDescriptionConverterViewModel> | ||
| { | ||
| public EnumDescriptionConverterPage(EnumDescriptionConverterViewModel enumDescriptionConverterViewModel) | ||
| : base(enumDescriptionConverterViewModel) | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.ComponentModel; | ||
| using System.ComponentModel.DataAnnotations; | ||
| using System.Text; | ||
TheCodeTraveler marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| using CommunityToolkit.Mvvm.ComponentModel; | ||
|
|
||
| namespace CommunityToolkit.Maui.Sample.ViewModels.Converters; | ||
|
|
||
| public partial class EnumDescriptionConverterViewModel : BaseViewModel | ||
| { | ||
| [ObservableProperty] | ||
| public partial ModeName SelectedMode { get; set; } | ||
|
|
||
| public EnumDescriptionConverterViewModel() | ||
| { | ||
| SelectedMode = ModeName.DarkMode; | ||
| } | ||
| } | ||
|
|
||
| public enum ModeName | ||
| { | ||
| // No Description needed for one word enum members that | ||
| // are spelled the way you want to display them | ||
|
|
||
| [Description("Light Mode")] // Can Use Description attribute | ||
| LightMode, | ||
| [Display(Name = "Dark Mode")] // Or Display attribute with Name property | ||
| DarkMode, | ||
| System | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,146 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // CommunityToolkit.Maui.Analyzers/EnumDescriptionGenerator.cs | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using System; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using System.Collections.Generic; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using System.Linq; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using System.Text; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| using CommunityToolkit.Maui.SourceGenerators.Helpers; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using CommunityToolkit.Maui.SourceGenerators.Models; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| using Microsoft.CodeAnalysis; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using Microsoft.CodeAnalysis.CSharp; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using Microsoft.CodeAnalysis.CSharp.Syntax; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| using Microsoft.CodeAnalysis.Text; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace CommunityToolkit.Maui.Analyzers; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| [Generator] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| public class EnumDescriptionGenerator : IIncrementalGenerator | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+18
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Using fields instead of const to avoid naming rule violations | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static readonly string displayAttributeName = "System.ComponentModel.DataAnnotations.DisplayAttribute"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| static readonly string descriptionAttributeName = "System.ComponentModel.DescriptionAttribute"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| static EnumDescriptionModel? CreateEnumDescriptionModel(INamedTypeSymbol? enumSymbol) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (enumSymbol is null || enumSymbol.TypeKind != TypeKind.Enum || !EnumDescriptionGeneratorHelper.IsAccessibleFromNamespace(enumSymbol)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| string ns = enumSymbol.ContainingNamespace.ToDisplayString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string enumName = enumSymbol.Name; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string enumQualifiedName = enumSymbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| var members = new List<EnumMemberModel>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| foreach (IFieldSymbol member in enumSymbol.GetMembers().OfType<IFieldSymbol>()) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (member.ConstantValue is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| string? description = EnumDescriptionGeneratorHelper.GetDescriptionFromDescriptionAttribute(member, descriptionAttributeName); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string? displayName = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string? resourceType = null; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (EnumDescriptionGeneratorHelper.TryGetDisplayInfo(member, displayAttributeName, out var dn, out var rt)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| displayName = dn; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| resourceType = rt?.ToDisplayString(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| members.Add(new EnumMemberModel( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| member.Name, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| description, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| displayName, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| resourceType | ||||||||||||||||||||||||||||||||||||||||||||||||||
| )); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| return new EnumDescriptionModel(enumName, ns, enumQualifiedName, members); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| public void Initialize(IncrementalGeneratorInitializationContext context) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| IncrementalValuesProvider<EnumDescriptionModel?> enumModels = context.SyntaxProvider | ||||||||||||||||||||||||||||||||||||||||||||||||||
| .CreateSyntaxProvider( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| predicate: static (node, _) => node is EnumDeclarationSyntax, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| transform: static (ctx, _) => EnumDescriptionGenerator.CreateEnumDescriptionModel(ctx.SemanticModel.GetDeclaredSymbol(ctx.Node) as INamedTypeSymbol)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| .Where(static model => model is not null); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| context.RegisterSourceOutput(enumModels, (spc, model) => | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (model is null) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| string code = GenerateCode(model); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string hintName = $"{model.QualifiedName.Replace(".", "_")}.g.cs"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| spc.AddSource(hintName, SourceText.From(code, Encoding.UTF8)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| static string GenerateCode(EnumDescriptionModel model) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string ns = model.Namespace; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string enumName = model.EnumName; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string enumQualifiedName = model.QualifiedName; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Remove 'global::' prefix if present | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string cleanedQualifiedName = enumQualifiedName.StartsWith("global::", StringComparison.Ordinal) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ? enumQualifiedName.Substring(8) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| : enumQualifiedName; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Replace invalid characters for identifiers | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string baseClassName = cleanedQualifiedName.Replace(".", "_").Replace("+", "_"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string initializerClassName = $"{baseClassName}_DescriptionInitializer"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| var sb = new StringBuilder(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine("// <auto-generated />"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine("#nullable enable"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine("using CommunityToolkit.Maui.Converters;"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!string.IsNullOrEmpty(ns)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine($"namespace {ns};"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine($"internal static class {initializerClassName}"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine("{"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine(" [global::System.Runtime.CompilerServices.ModuleInitializer]"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine(" internal static void Initialize()"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine(" {"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine(" var dict = new global::System.Collections.Generic.Dictionary<string, string>();"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine(" var resolvers = new global::System.Collections.Generic.Dictionary<string, global::System.Func<global::System.Globalization.CultureInfo?, string>>();"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| foreach (var member in model.Members) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| string fallbackDescription = member.Description ?? member.Name; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (member.DisplayName is not null && !string.IsNullOrWhiteSpace(member.DisplayName)) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (member.ResourceType is not null) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Cannot safely resolve localized resource access at compile-time | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine($" dict[\"{member.Name}\"] = \"{EnumDescriptionGeneratorHelper.EscapeString(fallbackDescription)}\";"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine($" dict[\"{member.Name}\"] = \"{EnumDescriptionGeneratorHelper.EscapeString(member.DisplayName)}\";"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| sb.AppendLine($" dict[\"{member.Name}\"] = \"{EnumDescriptionGeneratorHelper.EscapeString(fallbackDescription)}\";"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+120
to
+131
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (member.DisplayName is not null && !string.IsNullOrWhiteSpace(member.DisplayName)) | |
| { | |
| if (member.ResourceType is not null) | |
| { | |
| // Cannot safely resolve localized resource access at compile-time | |
| sb.AppendLine($" dict[\"{member.Name}\"] = \"{EnumDescriptionGeneratorHelper.EscapeString(fallbackDescription)}\";"); | |
| continue; | |
| } | |
| sb.AppendLine($" dict[\"{member.Name}\"] = \"{EnumDescriptionGeneratorHelper.EscapeString(member.DisplayName)}\";"); | |
| continue; | |
| } | |
| sb.AppendLine($" dict[\"{member.Name}\"] = \"{EnumDescriptionGeneratorHelper.EscapeString(fallbackDescription)}\";"); | |
| if (EnumDescriptionGeneratorHelper.TryGetLocalizedDisplayResolverExpression(member, out string resolverExpression)) | |
| { | |
| sb.AppendLine($" resolvers[\"{member.Name}\"] = {resolverExpression};"); | |
| continue; | |
| } | |
| string displayText = !string.IsNullOrWhiteSpace(member.DisplayName) | |
| ? member.DisplayName | |
| : fallbackDescription; | |
| sb.AppendLine($" dict[\"{member.Name}\"] = \"{EnumDescriptionGeneratorHelper.EscapeString(displayText)}\";"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BillyMartin1964 - What are your thoughts on this comment from CoPilot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, @TheCodeTraveler , I'm getting lost. After making all the changes that you guys wanted, it quit working. Copilot says that the generator is only generating for the enums that are actually in the Toolkit and not the enums in the user's app.
I know you're busy, but I could really use another set of eyes. This is so close to just throw it away now.
Uh oh!
There was an error while loading. Please reload this page.