Skip to content
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

Custom "method signature" code can be replaced with call to IMethodSymbol.ToDisplayString(...) #66

Open
simonmckenzie opened this issue Dec 6, 2024 · 0 comments

Comments

@simonmckenzie
Copy link
Contributor

I have noticed that while the project has a lot of logic for the generation of method parameters, return types, generic type constraints, etc., the same result can be obtained by using .ToDisplayString(FullyQualifiedDisplayFormat) on the IMethodSymbol.

This means we could delete almost all of this logic and replace it with one line:

https://github.com/codecentric/net_automatic_interface/blob/9d66cad06170853f5b1741573e474f7b6592ee8b/AutomaticInterface/AutomaticInterface/Builder.cs#L100C25-L126C6

... and no doubt similar simplifications could be done for other parts of the interface generation.

What I'm not certain about is whether this is a good idea or not. I've done this replacement locally and all tests pass, but it does mean that it makes later customisation difficult, since all rendering decisions are passed off to Roslyn. Trying to address issues like #62, where the feature request is for something outside what Roslyn offers, would become much harder. Not sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant