I have a sbt project which I have imported into IntelliJ IDEA. This project includes the splain compiler plugin which includes colour codes in some compiler messages.
When compiling in IntelliJ IDEA then these colour codes are not interpreted. I can add "-P:splain:color:false"
to the Additional compiler options in Preferences which works but is lost when I refresh the sbt project.
Is there a way to set the scalacOptions
in sbt so that it only applies to IntelliJ IDEA?
The IntelliJ Scala plugin sets the -Didea.managed=true
system property when starting sbt instances, so this could work:
scalacOptions += if (System.getProperty("idea.managed") == "true") {
"-P:splain:color:false"
} else {
"-P:splain:color:true"
}