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

Generate Arbitrary instance for all types #544

Merged
merged 2 commits into from
Jan 17, 2024
Merged

Conversation

michaelpj
Copy link
Collaborator

Really not that hard in the end, just some plumbing and fussing with the code generation. They're now exported via an additional public library lsp-types-quickcheck.

I also moved some of the mechanical stuff for generating extra instances just based on the type names (lenses, and now Arbitrary instances) to use TH, because that is better than the literal code generation approach when it's not horribly complicated.

I'm not yet making much use of this. The next step would be to e.g. generate tests for every type that check round-trips, but I think this is enough for now. There's also a bit of work to do to get arbitrary instances for all messages, but I'm going to do that later also.

Fixes #347

@michaelpj
Copy link
Collaborator Author

Hmm, something is still screwy with the instances for message types. I'll put them back as they were for now until I can tackle them all properly.

@michaelpj
Copy link
Collaborator Author

Possibly it's not really worth other people looking at this, it's mostly just codegen wrangling. The instances are all just generic-derived or newtype-derived or derived via enums.

@michaelpj michaelpj merged commit 794d689 into master Jan 17, 2024
14 checks passed
soulomoon pushed a commit to soulomoon/lsp that referenced this pull request Apr 8, 2024
* Generate Arbitrary instances for all types

* More format
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.

Arbitrary instances for types
1 participant