Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

286 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dotnet Stars Discord workflow nuget nuget Issues Open Forks License Twitter

Twitter Twitter

TimeWarp.SourceGenerators

TimeWarp Logo

TimeWarp.SourceGenerators is our collection of source generators.

Give a Star! ⭐

If you like or are using this project please give it a star. Thank you!

Features

Interface Delegation Generator

Implements Delphi-style interface delegation for C#. Mark fields or properties with [Implements] to automatically generate forwarding methods for interface members.

Usage

public partial class DataService : ILogger, IDataProcessor<string>
{
    [Implements]
    private readonly ILogger Logger;

    [Implements]
    private readonly IDataProcessor<string> Processor;

    public DataService(ILogger logger, IDataProcessor<string> processor)
    {
        Logger = logger;
        Processor = processor;
    }

    // Optionally override specific methods
    public string Process(string input)
    {
        // Custom implementation
        return Processor.Process(input.ToUpper());
    }
}

The generator will automatically create forwarding implementations for all interface methods and properties, except those you explicitly implement.

Requirements

  • Class must be marked as partial
  • Class must implement the interface being delegated
  • Field/property type must be the interface or implement the interface

Diagnostics

  • TW0004: Class must be partial for interface delegation
  • TW0005: Class does not implement the delegated interface
  • TW0006: Multiple fields delegate the same interface

File Name Rule Analyzer

Enforces kebab-case naming for C# files, including multi-dot partials (e.g. application-state.close-modal.cs) when every segment is kebab-case.

Configuration

Configure exceptions in .editorconfig:

[*.cs]
dotnet_diagnostic.TW0001.excluded_files = Program.cs;Startup.cs;*.Designer.cs

Diagnostic ID prefixes (SSOT)

Prefix Package
TW TimeWarp.SourceGenerators (this package) — shipped diagnostics TW0001TW0006
TWA TimeWarp Architecture only — not used by this package

Do not enable, suppress, or configure this package’s rules with Architecture IDs such as TWA001 / TWA*. File-name kebab-case is TW0001 (dotnet_diagnostic.TW0001.*, #pragma warning disable TW0001). Architecture TWA* keys do not apply here.

Getting started

To quickly get started I recommend reviewing the samples in this repo.

Installation

dotnet add package TimeWarp.SourceGenerators

You can see the latest NuGet packages from the official TimeWarp NuGet page.

Releases

See the Release Notes

Unlicense

License

Contributing

Time is of the essence. Before developing a Pull Request I recommend opening a discussion.

Please feel free to make suggestions and help out with the documentation. Please refer to Markdown for how to write markdown files.

Contact

Sometimes the github notifications get lost in the shuffle. If you file an issue and don't get a response in a timely manner feel free to ping on our Discord server.

Discord

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages