Skip to content

SourceGeneratorHelpers.GenerateCode() uses the type name to define the source code hint #651

@Fresa

Description

@Fresa

Since the hint name to context.AddSource must be unique within the context, there seems to be some trickery behind the scenes to define a unique name for each source code generated, but that doesn't work if SourceGeneratorHelpers.GenerateCode() is called multiple times with specifications that have the same type name, but the namespace differ.

The flat structure generated is also quite difficult to navigate, as many types will be called the same thing, i.e. Foo1.g.cs, Foo2.g.cs, Foo3.g.cs etc.

Would be great if it was possible to direct the hint name, or let the fully qualified type declaration name dictate the structure as is common in C#, i.e. Bar.Foo -> Bar/Foo.g.cs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions