在IntelliJ IDEA 15社区版中格式化“ * .scala.html”代码

青年同胞

在IntelliJ IDEA 15.0.1 Community Edition中应该使用一些特殊的配置设置*.scala.html来正确格式化文件吗?

我在詹姆斯·沃德James Ward)的评论中读到了他的回答:https : //stackoverflow.com/a/17478667/1065693它应该起作用,至少部分起作用。

因此,我安装了Scala插件,并按照有关导入PlayFramework项目的说明进行操作:https ://www.jetbrains.com/idea/help/getting-started-with-play-2-x.html

然后,我发出了Code -> Reformat Code,但是它产生了一个不再编译的代码,例如:

@(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>

变成:

@(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>

断开路径会/导致错误。我尝试在中更改其他设置Editor -> Code Style -> HTML(或者也许应该使用Scala?),但这无济于事。配置中是否有可以使用的东西?

比西奥

Community Edition中不提供对Play框架和其他一些标准的支持(有关更多详细信息,请查看功能页

无论如何,您都可以尝试解决此问题,即通过对标记的属性使用单引号(请注意,W3C将此声明为绝对有效的方法)

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章