Using scala format, how to exclude view files from playframework

1k Views Asked by At

My .scalafmt.conf file has the following:

project.excludeFilters = [
    "glob:**.html"
]

When I edit a playframework twirl view file, it formats the file and it screws up the format and causes issues e.g. puts a space after @ and breaks the template code.

Why isn't the exclude filter working?

I also tried exclude paths like this:

excludePaths = [
    "glob:**/play-web/app/views/**.scala.html"
  ]

What am I doing wrong?

I am using VS Code also.

My project layout is (multi project sbt):

project/
commons-lib/
play-web/
.scalafmt.conf
build.sbt
1

There are 1 best solutions below

0
On BEST ANSWER

Since scala format defaults to specific file formats like .scala, .sbt and .sc it actually won't format .scala.html files.

This ended up being a VS code auto formatting issue for .html files.

I disabled it via:

"html.format.enable": false,