Replies: 3 comments
-
|
cc @mkurz |
Beta Was this translation helpful? Give feedback.
-
You are right, there are no guidelines for twirl templates. It is basically up to the devs how they want to structure twirl code. You probably know that already, but Twirl by default supports following formats:
Maybe it makes sense if you follow the guidelines you have implemented for html / text / xml / js files already anyway? In the end there a just a handful twirl tags anyway (after the imports and the template parameters). Devs can implement their own twirl formats as well - maybe you can just detect that with a pattern like btw, I would not indent anything after the template params so the rough scheme should probably be: |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the response @mkurz
Yes that's what we do usually, it still requires some work for a new extension but most of the functionality is reused. I was just confused about examples like: which a normal HTML element would indent, but here the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We, in (IntelliJ Scala Plugin team) are reimplementing the formatter for Play templates and I noticed there are no guidelines or suggested formatting structure in the documentation. It would be nice if a suggested formatting structure existed.
I tried to infer it from samples but sometimes they are contradicting. For example, should the rest of the document be indented if the file contains template parameters or not? https://github.com/playframework/play-samples/blob/3.0.x/play-scala-isolated-slick-example/app/views/update.scala.html and https://github.com/playframework/play-samples/blob/3.0.x/play-scala-isolated-slick-example/app/views/index.scala.html do different things in this case.
Also, there is some ambiguity about when to indent the children of a HTML element. For example,
uldoesn't seem indent the child play expression in it based on this example:but div does:
is this intentional?
Beta Was this translation helpful? Give feedback.
All reactions