Scala.meta macro support in EAP


For my master thesis, I am currently experimenting with scala.meta. According to this workshop, it should be possible to enable scala.meta support in Intellij IDEA by using the EAP version, which seems really neat. So I installed this version with the EAP version of the Scala plugin. Unfortunately, my code still turns red in the IDE. I am using version 2016.3.2.10 of the plugin.

package scalaplayground.macros

import scala.annotation.compileTimeOnly
import scala.meta._

@compileTimeOnly("scalaplayground.macros not expanded")
class Main extends scala.annotation.StaticAnnotation {
  inline def apply(defn: Any): Any = meta {
    val q"object $name { ..$stats }" = defn
    val main = q"def main(args: Array[String]): Unit = { ..$stats }"
    q"object $name { $main }"
评论操作 固定链接

EAP with scala.meta support will be out next week. But in case you're eager to test the upcoming features, you can switch to "Nightly" update channel in Scala plugin settings.

评论操作 固定链接

Thanks for your reply. Good to know that it's coming to the EAP version soon!