-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc Cookbook Auto Interface Implementation #73906
Conversation
Added documentation of IncrementalGenerators
@dotnet-policy-service agree |
@333fred, @CyrusNajmabadi PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, this type of generator is not something that we want to put in the cookbook or recommend that people do. Going through all interfaces implemented by a type, particularly the way that ends up being implemented here (using a Compilation
as an incremental parameter) is not actually incremental in any fashion and will kill IDE performance. As of yet, we have no ideas for how to implement this type of generator efficiently enough to suggest that people should write a generator in this fashion.
A restructuring of the generator that attributes the types that get their interfaces auto-implemented, rather than the interfaces themselves, would be acceptable to include. But the current structure is something that we explicitly recommend against doing in this very document.
@333fred [AutoImplement(nameof(IUserInterface), nameof(IUserInterface2))]
public partial class UserClass : IUserInterface, IUserInterface2
{
public string UserProp { get; set; }
} Moving the attribute to the class would let me use "ForAttributeWithMetadataName" to get only the decorated classes. If at least one of you gives me the ok, I will start implementing this solution |
Yes, that's exactly the type of structure I meant when I said a change could be acceptable to include. |
@333fred |
That info is already available in the context of your transform callback in |
@333fred You are right, now it should be more performant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done review pass. Large step in the right direction, but there's still plenty of room for improvement.
Include autogenerated comment Co-authored-by: Fred Silberberg <[email protected]>
Co-authored-by: Fred Silberberg <[email protected]>
Co-authored-by: Fred Silberberg <[email protected]>
Co-authored-by: Fred Silberberg <[email protected]>
Co-authored-by: Fred Silberberg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CyrusNajmabadi @chsienki for reviews as well please.
Co-authored-by: Fred Silberberg <[email protected]>
Co-authored-by: Fred Silberberg <[email protected]>
Thanks @bdbonazz! |
Added documentation of IncrementalGenerators Cookbook about Auto interface implementation
#72149
Working solution: https://github.com/bdbonazz/AutoImplementGenerator