HavenDV / H.Generators.Extensions

A set of extensions to simplify the code of generators
MIT License
11 stars 3 forks source link
exceptions extensions settings source-generator

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:

<PackageReference Include="H.Generators.Extensions" Version="1.4.2" PrivateAssets="all" />

I want to note that PrivateAssets="all" is required to rule out some issues.

Extensions

AnalyzerConfigOptionsProviderExtensions



### 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