Skip to content

Added code generation for OnXyz and SendXyz methods (1/2) #256

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

Merged
merged 4 commits into from
Jul 18, 2020

Conversation

david-driscoll
Copy link
Member

This is part one that only includes a few file changes to make the objective a little clearer. the next is just a bunch of deleted code (yay deleted code! 🥳 )

@david-driscoll
Copy link
Member Author

TLDR: I'm sick of trying to keep all the methods in sync, but want to offer both an interface and delegate based interface for every handler. This solves that since handlers follow a fairly common pattern.

@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #256 into master will increase coverage by 0.01%.
The diff coverage is 61.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #256      +/-   ##
==========================================
+ Coverage   62.06%   62.07%   +0.01%     
==========================================
  Files         383      387       +4     
  Lines       11489    12605    +1116     
  Branches     1361     1456      +95     
==========================================
+ Hits         7131     7825     +694     
- Misses       3788     4178     +390     
- Partials      570      602      +32     
Impacted Files Coverage Δ
...nRpc/Generation/GenerateHandlerMethodsAttribute.cs 0.00% <0.00%> (ø)
...nRpc/Generation/GenerateRequestMethodsAttribute.cs 0.00% <0.00%> (ø)
src/Protocol/Document/ITypeDefinitionHandler.cs 0.00% <ø> (-52.55%) ⬇️
src/Protocol/General/IShutdownHandler.cs 0.00% <ø> (-70.84%) ⬇️
src/JsonRpc.Generators/Helpers.cs 57.10% <57.10%> (ø)
...nRpc.Generators/GenerateHandlerMethodsGenerator.cs 65.87% <65.87%> (ø)
...nRpc.Generators/GenerateRequestMethodsGenerator.cs 71.98% <71.98%> (ø)
src/JsonRpc.Generators/GeneratorDiagnostics.cs 100.00% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d82ff82...607cf5f. Read the comment docs.

@NTaylorMullen
Copy link

Really cool idea! First seeing source generators in action. How was the dev experience with em?

@david-driscoll
Copy link
Member Author

@NTaylorMullen I was actually pretty pleased with it. I have not played with the latest source generators but I assume they would be fairly similar. Sometimes I'd break things literally in half, break the generator, and using generated methods and things fall apart fast... however that's what unit tests are for.

Copy link
Collaborator

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really judge the generator code cause I don't have the domain expertise, but I'm so excited to have all the On/Send messages available.

@david-driscoll david-driscoll merged commit 20c60b6 into master Jul 18, 2020
@david-driscoll david-driscoll deleted the feature/code-generation branch July 18, 2020 04:30
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

Successfully merging this pull request may close these issues.

3 participants