An open API service indexing awesome lists of open source software.

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

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