Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scalafmtOnCompile doesn't work for additional confifgurations #18

Open
hseeberger opened this issue Jun 19, 2017 · 5 comments
Open

scalafmtOnCompile doesn't work for additional confifgurations #18

hseeberger opened this issue Jun 19, 2017 · 5 comments
Labels

Comments

@hseeberger
Copy link
Contributor

hseeberger commented Jun 19, 2017

I'm using the sbt-multi-jvm plugin which adds the MultiJvm configuration. I have added

inConfig(MultiJvm)(scalafmtSettings)

but sources under src/multi-jvm are not formatted on compile and also not when executing multi-ivm/scalafmt.

@dvgica
Copy link

dvgica commented Jun 20, 2017

Seeing something similar with the IntegrationTest configuration in vanilla SBT. However, it:scalafmt does work for me.

I have:

// ...
.settings(inConfig(IntegrationTest)(scalafmtSettings))
// ...

scalafmtOnCompile in ThisBuild := true

@pauldraper pauldraper added the bug label Jun 21, 2017
@lloydmeta
Copy link

I've got a multi-module project that has sub-projects that cross-build JVM and ScalaJS, and some that are just JVM. Reformat-on-compile and issuing scalafmt don't work on the ones that are JVM+ScalaJS. Is that related to this bug?

@fthomas
Copy link
Contributor

fthomas commented Jul 11, 2017

I think the reason for this bug could be this line:

sourceDirectories := Seq(scalaSource.value)

The plugin should pick up all source directories if this is changed to sourceDirectories := unmanagedSourceDirectories.value. There has been a similar issue in the original scalafmt sbt plugin: scalameta/scalafmt#229 which also contains more info about unmanagedSourceDirectories.

@pauldraper
Copy link
Contributor

This should probably be changed to use sources. Without examples, it's impossible to know if it will fix these, but I think it will be better.

@hseeberger
Copy link
Contributor Author

I think you should not touch sourceDirectories at all, i.e. delete the above mentioned line.

Then in lines 148 and 150 use unmanagedSourceDirectories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants