سؤال

The Play Framework is a web framework for Scala and Java. Its Scala interface uses .scala.html template files for automatically generating HTML files. Is there a tool for automatically formatting these files?

Some more context: In Eclipse, with the Scala and Play plugins, the formatter can automatically format Scala source files and the routes file, but it does nothing on .scala.html files.

هل كانت مفيدة؟

المحلول

IntelliJ IDEA is able to format Scala templates.

There is an open feature request for the ScalaIDE Play plugin for formatting Scala Templates:

https://github.com/scala-ide/scala-ide-play2/issues/118

نصائح أخرى

There also is a Sublime Text plugin edited by Guillaume Bort himself.

The Pleasure play Plugin (NetBeans Plugin for play framework) is able to format scala templates too: scala templates features on pleasure

Format the code using the NetBeans way: just pressing Alt+Shift+F or right click the file -> and select Format

Note that the number of spaces between columns can be specified at Tools -> Options -> Miscellaneous -> Play Framework and specifying the amount of spaces in the Scala Templates indent Spaces text field.

Note: I created this plugin

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top