Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
436 views
in Technique[技术] by (71.8m points)

How to write Intellij IDEA plugin for scala macros

I wrote macro that is working after compilation, but the problem is that Intellij IDEA doesn't see my generated code and some red lines appear. So i found explanation here, that I need to write IDEA plugin that will allow IDEA recognize my generated code. The problem is that i cannot use SyntheticMembersInjector because of missing dependency. Is it possible to write IDEA plugin for my own scala macros?

my plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "1.0.2")
addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "3.8.4")

my build.sbt:

import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport.dockerExposedPorts
import sbt.Keys.{scalacOptions, version}

lazy val coreProject = (project in file("."))
  .enablePlugins(JavaAppPackaging, DockerPlugin, AkkaGrpcPlugin)
  .settings(
    scalaVersion := "2.12.12",
    name := "CDMS",
    version := "0.1",
    libraryDependencies ++= BuildConfig.projectDependencies,
    dockerBaseImage := "adoptopenjdk/openjdk15:alpine",
    dockerExposedPorts += 9002
  )
  .dependsOn(validationProject)

lazy val validationProject = (project in file("validation"))
  .enablePlugins(SbtPlugin)
  .settings(
    scalaVersion := "2.12.12",
    sbtPlugin := true,
    libraryDependencies ++= BuildConfig.monocleDependencies
  )

question from:https://stackoverflow.com/questions/65919739/how-to-write-intellij-idea-plugin-for-scala-macros

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...