Added ToShortNames and DisplayShortNames dictionary#139
Open
licon4812 wants to merge 7 commits intoEngRajabi:masterfrom
Open
Added ToShortNames and DisplayShortNames dictionary#139licon4812 wants to merge 7 commits intoEngRajabi:masterfrom
licon4812 wants to merge 7 commits intoEngRajabi:masterfrom
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for handling "short names" for enum values through a new ShortName attribute in the Supernova.Enum.Generators project. The enhancement enables developers to define and access abbreviated representations of enum values alongside existing display names and descriptions.
Key changes include:
- Introduction of short name processing in the enum source generator with dictionary storage and extension methods
- Addition of
ToShortNameFastextension method andDisplayShortNamesDictionaryproperty generation - Comprehensive test coverage for the new short name functionality including edge cases
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Supernova.Enum.Generators/EnumSourceGenerator.cs | Core implementation of short name processing, dictionary generation, and extension method creation |
| Supernova.Enum.Generators/SourceGeneratorHelper.cs | Added constants for new extension method and property names |
| test/UnitTests/EnumGeneratorTest.cs | Updated test enum with ShortName attributes and added comprehensive unit tests |
| test/UnitTests/InternalEnumGeneratorTest.cs | Mirror of public enum tests for internal enum validation |
| test/Console.Test.Benchmark/Program.cs | Added performance benchmarks and native implementation for comparison |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for handling "short names" for enum values in the
Supernova.Enum.Generatorsproject. The changes include updates to the source generator to process a newShortNameattribute, generate corresponding extension methods and dictionaries, and add comprehensive tests to validate the functionality.Linked issues
resolves #138
Enhancements to Enum Source Generator:
enumShortNamesto store short names for enum members and updated the source generator to populate it when theShortNameattribute is provided. (Supernova.Enum.Generators/EnumSourceGenerator.cs: [1] [2]ToShortNamemethod to generate extension methods for converting enum values to their short names. (Supernova.Enum.Generators/EnumSourceGenerator.cs: [1] [2]DisplayShortNamesDictionarymethod to generate a dictionary mapping enum values to their short names. (Supernova.Enum.Generators/EnumSourceGenerator.cs: Supernova.Enum.Generators/EnumSourceGenerator.csR395-R419)Updates to Source Generator Helper:
ToShortNameFastextension method andDisplayShortNamesDictionaryproperty. (Supernova.Enum.Generators/SourceGeneratorHelper.cs: Supernova.Enum.Generators/SourceGeneratorHelper.csR11-R17)Test Enhancements:
UserType,UserTypeTest, andInternalUserTypeTest) to include theShortNameattribute for enum members. (test/Console.Test.Benchmark/Program.cs: [1]test/UnitTests/EnumGeneratorTest.cs: [2]test/UnitTests/InternalEnumGeneratorTest.cs: [3]ToShortNameFastextension method, including cases for undefined values and default values. (test/UnitTests/EnumGeneratorTest.cs: [1] [2];test/UnitTests/InternalEnumGeneratorTest.cs: [3] [4]ToShortNameFastandToShortNameNativemethods to measure performance. (test/Console.Test.Benchmark/Program.cs: [1] [2]