https://github.com/havendv/h.generators.extensions
A set of extensions to simplify the code of generators
https://github.com/havendv/h.generators.extensions
exceptions extensions settings source-generator
Last synced: 6 months ago
JSON representation
A set of extensions to simplify the code of generators
- Host: GitHub
- URL: https://github.com/havendv/h.generators.extensions
- Owner: HavenDV
- License: mit
- Created: 2022-05-18T08:10:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-16T12:23:26.000Z (about 1 year ago)
- Last Synced: 2024-10-06T09:22:34.764Z (about 1 year ago)
- Topics: exceptions, extensions, settings, source-generator
- Language: C#
- Homepage:
- Size: 255 KB
- Stars: 11
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# H.Generators.Extensions
A set of extensions to simplify the code of generators.
In addition to extensions, this library also adds a .props file to automatically add your generation-time dependencies
to the NuGet package and Integration tests.## Install
The usage is pretty simple:
```xml```
I want to note that PrivateAssets="all" is required to rule out some issues.## Extensions
### AnalyzerConfigOptionsProviderExtensions
- `options.GetGlobalOption(string name)`
- `options.GetOption(AdditionalText, string name)`
- `options.GetRequiredGlobalOption(string name)`
- `options.GetRequiredOption(AdditionalText, string name)`
- `options.TryRecognizeFramework()`
- `options.RecognizeFramework()`
To recognize the framework, you will need to add the following code to your %PackageId%.props:
```xml
$(DefineConstants.Replace(';',','))
```
### SourceProductionContextExtensions
- `context.ReportException(string id, Exception)`### StringExtensions
- `name.ToPropertyName()`
- `name.ToParameterName()`
- `text.RemoveBlankLinesWhereOnlyWhitespaces()`
- `text.NormalizeLineEndings(string? newLine = null)`
- `fullTypeName.ExtractNamespace()`
- `fullTypeName.ExtractSimpleName()`
- `fullTypeName.WithGlobalPrefix()`### EnumerableExtensions
- `values.Inject()`# H.Generators.Tests.Extensions
- `DictionaryAnalyzerConfigOptions`
- `DictionaryAnalyzerConfigOptionsProvider`
- `MemoryAdditionalText`
- `ImmutableArrayExtensions.NormalizeLocations`## Support
You can get answers to your questions in my discord support channel:
https://discord.gg/g8u2t9dKgE