nuoritoveri
nuoritoveri

Reputation: 2544

Formatting "*.scala.html" code in IntelliJ IDEA 15 community edition

Are there some special configuration settings that I should use in IntelliJ IDEA 15.0.1 Community Edition for *.scala.html files to be formatted correctly?

I read in James Ward comment to his answer: https://stackoverflow.com/a/17478667/1065693 that it should work, a least partially.

So I installed Scala plugin and followed the instructions on importing a PlayFramework project: https://www.jetbrains.com/idea/help/getting-started-with-play-2-x.html

Then I issued Code -> Reformat Code, but it produced a code that is not compiling any more, for example:

@(title: String)(content: Html)

@import play.i18n._

<!DOCTYPE html>

<html class="no-js" lang="pl">
    <head>
        <link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
</head>
    <body class="homepage">
        <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
    </body>
</html>

is turned to:

@(title: String)(content: Html)

@import play.i18n._

<!DOCTYPE html>

<html class="no-js" lang="pl">
<head>
    <link rel="stylesheet" media="screen" href="@routes.Assets.versioned(" stylesheets
    /main.css")">
</head>
<body class="homepage">
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
</body>
</html>

Breaking paths on / results in errors. I tried to change different settings in Editor -> Code Style -> HTML (or maybe I should use Scala?), but it didn't help. Is there something in the configuration that could use?

Upvotes: 0

Views: 340

Answers (1)

biesior
biesior

Reputation: 55798

Support for Play Framework and some other standards is not available in Community Edition (check features pages for more details)

Anyway you can try to workaround this problem i.e. by using single quotes for tag's attributes (note that W3C declares this as absolutely valid approach)

<link rel="stylesheet" media="screen" href='@routes.Assets.versioned("stylesheets/main.css")'>

Upvotes: 2

Related Questions