JetBrains / sbt-idea-plugin

Develop IntelliJ plugins with Scala and SBT
Apache License 2.0
97 stars 28 forks source link

Where does sbt-idea-plugin put source code for external plugins? #54

Closed maseev closed 4 years ago

maseev commented 4 years ago

My build.sbt file looks like the following:

intellijPluginName in ThisBuild := "my-plugin"
intellijBuild in ThisBuild := "2019.3.3"
intellijExternalPlugins += "org.intellij.scala:2019.3.720:Nightly".toPlugin

name := "my-plugin"

version := "0.1"

scalaVersion := "2.13.1"

plugins.sbt:

resolvers += Resolver.url("jetbrains-sbt", url(s"https://dl.bintray.com/jetbrains/sbt-plugins"))(Resolver.ivyStylePatterns)

addSbtPlugin("org.jetbrains" % "sbt-idea-plugin" % "3.5.0")

sbt-idea-plugin was able to download the IntelliJ Platform SDK and Scala plugin.

Unfortunately, I was only able to find source code for the IntelliJ Platform SDK (it was downloaded to /home/my-plugin/sdk/2019.3.3/sources.zip and I had to manually set this folder as a source folder inside the IDE) but not for the Scala plugin.

Right now it looks like sbt-idea-plugin doesn't download source code for external plugins.

maseev commented 4 years ago

After the restart, the IDE was able to pick up the source code for the Scala plugin automatically.

mutcianm commented 4 years ago

Hm, sbt-idea-plugin indeed does not download sources of the plugins from the plugin repo at the moment, but it's a reasonable feature request. I'm not completely sure why the IDE was able to pick up the source code for the Scala plugin.

maseev commented 4 years ago

I completely forgot that I ended up downloading the source code for the Scala plugin myself by cloning the GitHub repo and setting the source code root inside the IDE.

maseev commented 4 years ago

I've got zio-intellij imported in IntelliJ IDEA and I can access the source code of the Java plugin but not the Scala plugin source code. Something tells me that the Scala plugin comes without any source code when you specify it as a plugin you depend on in your build configuration. zio-intellij uses gradle-intellij-plugin

mutcianm commented 4 years ago

The Java plugin is a bundled plugin(distributed as a part of IJ IDEA) - therefore its sources are a part of sources.zip which comes with IJ IDEA distribution. External plugins are downloaded from IJ plugin marketplace which only contains binary artifacts with no sources.

mutcianm commented 4 years ago

Extracted this into a dedicated issue #55

maseev commented 4 years ago

For some reason I can't see the source code for the IntelliJ platform when I use the sbt-idea-plugin, but I can navigate through the same classes in a project which uses the gradle-intellij-plugin - meaning the IDE picks up the sources automatically. Does it have anything to do with the folder to which the sbt-idea-plugin downloads the IntelliJ SDK?

mutcianm commented 4 years ago

the most recent nightly build of Scala plugin should be able to attach IJ sources automatically if sbt-idea-plugin is enabled in the sbt build