Alexandr
Alexandr

Reputation: 349

Intellij IDEA and SBT syntax error

I am newbie in scala and SBT
I started using IDEA with SBT and faced unclear error (Expression type DslEntry must conform to Def.SettingsDefinition in SBT file)
enter image description here
It's very simple empty test project with jetty plugin (example taken from plugin site)

here's plugins.sbt source:

logLevel := Level.Warn

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "2.1.0")

This error is present only in IDEA GUI. If I compile project - all fine. from console - all fine. But I do not like when something does not work properly

I tried to download last version of SBT and set path to it in global IDEA properties - the problem persists.

I downloaded last intellij IDEA EAP with last version of scala plugin, sbt plugin and another plugins - the problem persists.

Can anyone help to solve this issue?
Thanks

Upvotes: 14

Views: 5032

Answers (2)

Justin Kaeser
Justin Kaeser

Reputation: 5948

This is an issue with the IntelliJ Scala plugin and will be fixed in an upcoming version: https://youtrack.jetbrains.com/issue/SCL-8413

Upvotes: 1

SexyNerd
SexyNerd

Reputation: 1124

Try this:

lazy val root = (project in file(".")).
  enablePlugins(JettyPlugin).
  settings(
    name := "test",
    scalaVersion := "2.11.7",
    version := "1.0"
  )

Updates: The followings are what I know:

The error comes from intellij's sbt plugin https://github.com/JetBrains/intellij-sbt/blob/master/idea-plugin/src/main/scala/org/jetbrains/sbt/language/SbtAnnotator.scala#L41.

The return type of (project in file(".")). enablePlugins(JettyPlugin) is Project. It is acceptable by sbt plugin.

However, if you use standalone enablePlugins(JettyPlugin), the return type is different, and it becomes DslEntry which makes the sbt plugin unhappy. Another way to workaround with that is simply to consume the return type of enablePlugins. For example:

val foo = enablePlugins(JettyPlugin)

Upvotes: 17

Related Questions