JetBrains / sbt-idea-plugin

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

PsiClass not found in 2019.x #22

Closed CarterWilliam closed 5 years ago

CarterWilliam commented 5 years ago

Thanks for this plugin!

I'm trying to get the example project working for Intellij 2019.2.2 Community but I'm running into this compile error:

[error] C:\Users\WilliamCarter\workspace\ijext-sample-project\ijext\src\main\scala\org\jetbrains\scala\libextensions\test\MacroDynamicSupport.scala:12:89: Symbol 'type com.intellij.psi.PsiAnnotationMemberValue' is missing from the classpath.
[error] This symbol is required by 'trait org.jetbrains.plugins.scala.lang.psi.api.expr.ScExpression'.
[error] Make sure that type PsiAnnotationMemberValue is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'ScExpression.class' was compiled against an incompatible version of com.intellij.psi.
[error]   override def expandMacro(macros: ScFunction, context: MacroInvocationContext): Option[ScExpression] = {
[error]                                                                                         ^
[error] C:\Users\WilliamCarter\workspace\ijext-sample-project\ijext\src\main\scala\org\jetbrains\scala\libextensions\test\MacroFooableSupport.scala:14:17: object ScParameterizedType is not a case class, nor does it have an unapply/unapplySeq member
[error]       case Some(ScParameterizedType(_, Seq(tp))) => tp.canonicalText
[error]                 ^
[error] C:\Users\WilliamCarter\workspace\ijext-sample-project\ijext\src\main\scala\org\jetbrains\scala\libextensions\test\MySampleInjector.scala:8:9: Class com.intellij.psi.PsiClass not found - continuing with a stub.
[error]     if (source.findAnnotationNoAliases("org.jetbrains.scala.libextensions.test.MySampleAnnotation") != null) {
[error]         ^
[error] three errors found
[error] (support / Compile / compileIncremental) Compilation failed
[error] Total time: 14 s, completed 11-Sep-2019 14:36:26

We can ignore the error about ScParameterizedType no longer having an unapply because it doesn't but the other errors are more suprising because I would expect the Scala plugin jar to provide these implementations. I've checked my classpath as the error suggests and it does include the scala plugin jars:

  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\bcel-6.0.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\bsp4j-2.0.0-M4.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\commons-lang-2.6.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\compiler-shared.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\config-1.2.0.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\evo-inflector-1.2.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\fastparse_2.12-0.4.3.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\ipcsocket-1.0.0.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\ivy-2.4.0.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\jamm-0.3.1.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\org.eclipse.lsp4j.generator-0.5.0.jar,None)

  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\org.eclipse.lsp4j.jsonrpc-0.5.0.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\org.eclipse.xtend.lib-2.19.0.M2.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\org.eclipse.xtend.lib.macro-2.19.0.M2.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\org.eclipse.xtext.xbase.lib-2.19.0.M2.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\runners.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\sbt-structure-core_2.12-2018.2.1+4-88400d3f.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scala-compiler-indices-protocol_2.12-0.1.1.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scala-nailgun-runner.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scala-parser-combinators_2.12-1.0.6.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scala-play-2-jps-plugin.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scala-reflect.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scala-xml.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scalameta.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scalap.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scalariform_2.12-0.2.2.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scalastyle_2.12-1.0.0.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scalatest-finders-patched-0.9.9.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\scalaUltimate.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\sourcecode_2.12-0.1.3.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\spray-json_2.12-1.3.4.jar,None)
  ZipArchiveClassPath(C:\Users\WilliamCarter\.library-test-ijextPluginIC\sdk\192.6603.28\externalPlugins\Scala\lib\util-interface-1.1.2.jar,None)

The changes I've made to the example project can be found here: https://github.com/CarterWilliam/ijext-sample-project/commit/198860680cdd95d0d617cc7b34137e3da1129fa0.

mutcianm commented 5 years ago

Java support has been extracted into a separate plugin since IDEA 2019.2. You have to add ideaInternalPlugins += "java" to add it to classpath

see #23