akka / akka-grpc

Akka gRPC
https://doc.akka.io/docs/akka-grpc/
Other
431 stars 124 forks source link

Make generated code look nicer? #368

Open raboof opened 6 years ago

raboof commented 6 years ago

Because of the loops in our templates, the whitespace in the generated code is quite jumbled-up.

Since people may be looking at the generated code, it might be worth it to tweak some things to make the generated code look neater at the cost of making the templates less easily readable.

johanandren commented 6 years ago

I'm not sure it is a good idea, we also need to maintain that template, and flattening it to make the generated code "normal" makes the template very hard to read.

patriknw commented 6 years ago

Perhaps related to https://github.com/playframework/twirl/issues/141 ?

johanandren commented 6 years ago

Yeah, if twirl could output something that looks nice without much tweaking the template source that would be awesome.

dwijnand commented 6 years ago

Here are the steps I used to have a look at this (thanks @raboof for the help!):

  1. akka-grpc-play-interop-test-scala/test:products
  2. check play-interop-test-scala/target/scala-2.12/src_managed/main/example/myapp/helloworld/grpc/helloworld/GreeterServiceClient.scala

Given https://github.com/playframework/twirl/pull/169 I tried upgrade sbt-twirl to 1.3.14, but GreeterServiceClient.scala still contains:

    private val sayHelloRequestBuilder = {

        new ScalaUnaryRequestBuilder(sayHelloDescriptor, channel, options, settings)

    }

/cc @mkurz who authored the change in twirl. Do you know why the indentation isn't fixed?