scalafix icon indicating copy to clipboard operation
scalafix copied to clipboard

scalafix-codegen sbt-plugin?

Open armanbilge opened this issue 2 years ago • 2 comments

Sorry, yet-another-upstream-idea 😁

The idea is basically to turn this example project into a plugin: https://github.com/olafurpg/scalafix-codegen/blob/7fdaa50a94cc31ae7af2d2237c91bc9611b17fe1/build.sbt

I know it's a small snippet, but after copying it between a few projects gets old fast. So it would be cool to add it as a small plugin to sbt-scalafix, would that be of interest?

armanbilge avatar Sep 15 '22 20:09 armanbilge

Sorry, yet-another-upstream-idea grin

Keep them coming! I don't have a bandwidth to actively contribute these weeks (I have been reactive mostly), but I am definitely open to reviews.

I know it's a small snippet, but after copying it between a few projects gets old fast. So it would be cool to add it as a small plugin to sbt-scalafix, would that be of interest?

For sure, a ScalafixCodegenPlugin would be nice. Happy to see the scenarios you use it for, and maybe discuss how the plugin would work for a client here in this issue before going to implementation mode. https://github.com/hamnis/dataclass-scalafix/blob/main/readme.md is also derived from the same snippet, taking into account semantic rules (I suspect/hope we can remove the need for 2 separate projects by making ScalafixCodegenPlugin & ScalafixPlugin coordinate somehow).

bjaglin avatar Sep 16 '22 07:09 bjaglin

Awesome, thanks! We are using it for generating sources from GraphQL schema. And possibly in the future for enhancing Scala.js facades as well. https://github.com/gemini-hlsw/explore/blob/14af551f7fc3e0f51404b0b56b975f013924867f/build.sbt#L125-L137

Thanks for the pointer to the other example, we are also currently using the two-project setup. That's interesting about removing the need for that, I didn't realize that could be possible. Interesting :)

In lieu of discussion here I might put up a draft PR, I don't understand the pieces here well enough without actually playing with the code.

armanbilge avatar Sep 16 '22 17:09 armanbilge