1

original:

 <script src="@routes.Assets.versioned("javascripts/main.js")" type="text/javascript"></script>

Scala formatted:

<script src="@routes.Assets.versioned(" javascripts/main.js")" type="text/javascript"></script>

It is adding a space where the filename is, how can I fix this?

Is it better to have scala fmt somehow ignore js files?

Blankman
  • 259,732
  • 324
  • 769
  • 1,199

2 Answers2

1

Try to exclude js files for scalafmt. Can you try this to add to .scalafmt.conf:

project.excludeFilters = [
    "public/javascripts/.*"
    ".*\\.js"
    ".*html.*"
]

But I'm not sure, I can't test it now. Note, scalafmt won't fix broken format after adding these lines. You should do it manually

UPDATE: I could reproduce that issue on my machine also, but scalafmt is not changing html files. But Intellij Idea does, you can disable them for a scpefic block or entire file by adding this on top of your file

// @formatter:off

Source

Bob
  • 1,351
  • 11
  • 28
1

It is the editor formatter that tries to space out attributes. Not the scala formatter.

Quick workaround is to use single quotes for the attributes.

<script src='@routes.Assets.versioned("javascripts/main.js")' type="text/javascript"></script>
flurdy
  • 3,782
  • 29
  • 31