Closed Baccata closed 6 years ago
Another incomplete stacktrace I found in the logs : (nb : the start is not incomplete, this is literally how it was logged)
rvers.Subscriber$Implementation.onNext(Subscriber.scala:208)
at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.signalNext(SimpleBufferedSubscriber.scala:128)
at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.fastLoop(SimpleBufferedSubscriber.scala:193)
at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.run(SimpleBufferedSubscriber.scala:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
And another one (this one indicates that maybe kind-projector is messing things up)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at scala.tools.nsc.plugins.Plugin$.instantiate(Plugin.scala:190)
at scala.tools.nsc.plugins.Plugins.$anonfun$loadRoughPluginsList$9(Plugins.scala:47)
at scala.tools.nsc.plugins.Plugins.loadRoughPluginsList(Plugins.scala:47)
at scala.tools.nsc.plugins.Plugins.loadRoughPluginsList$(Plugins.scala:27)
at scala.tools.nsc.Global.loadRoughPluginsList(Global.scala:36)
at scala.tools.nsc.plugins.Plugins.roughPluginsList(Plugins.scala:50)
at scala.tools.nsc.plugins.Plugins.roughPluginsList$(Plugins.scala:50)
at scala.tools.nsc.Global.roughPluginsList$lzycompute(Global.scala:36)
at scala.tools.nsc.Global.roughPluginsList(Global.scala:36)
at scala.tools.nsc.plugins.Plugins.loadPlugins(Plugins.scala:86)
at scala.tools.nsc.plugins.Plugins.loadPlugins$(Plugins.scala:56)
at scala.tools.nsc.Global.loadPlugins(Global.scala:36)
at scala.tools.nsc.plugins.Plugins.plugins(Plugins.scala:102)
at scala.tools.nsc.plugins.Plugins.plugins$(Plugins.scala:102)
at scala.tools.nsc.Global.plugins$lzycompute(Global.scala:36)
at scala.tools.nsc.Global.plugins(Global.scala:36)
at scala.tools.nsc.plugins.Plugins.computePluginPhases(Plugins.scala:113)
at scala.tools.nsc.plugins.Plugins.computePluginPhases$(Plugins.scala:112)
at scala.tools.nsc.Global.computePluginPhases(Global.scala:36)
at scala.tools.nsc.Global.computePhaseDescriptors(Global.scala:690)
at scala.tools.nsc.Global.phaseDescriptors$lzycompute(Global.scala:695)
at scala.tools.nsc.Global.phaseDescriptors(Global.scala:695)
at scala.tools.nsc.Global$Run.<init>(Global.scala:1186)
at scala.tools.nsc.interactive.Global$TyperRun.<init>(Global.scala:1309)
at scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:1332)
at scala.tools.nsc.interactive.Global.<init>(Global.scala:286)
at scala.meta.metals.compiler.ScalacProvider$.newCompiler(ScalacProvider.scala:109)
at scala.meta.metals.compiler.ScalacProvider.loadNewCompilerGlobals(ScalacProvider.scala:63)
at scala.meta.metals.MetalsServices.$anonfun$installedCompilers$1(ScalametaServices.scala:115)
at monix.reactive.internal.operators.MapOperator$$anon$1.onNext(MapOperator.scala:44)
at monix.reactive.internal.operators.MapOperator$$anon$1.onNext(MapOperator.scala:46)
at monix.reactive.internal.operators.DoOnErrorOperator$$anon$1.onNext(DoOnErrorOperator.scala:36)
at monix.reactive.subjects.PublishSubject.sendOnNextToAll(PublishSubject.scala:123)
at monix.reactive.subjects.PublishSubject.onNext(PublishSubject.scala:97)
at monix.reactive.observers.Subscriber$Implementation.onNext(Subscriber.scala:208)
at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.signalNext(SimpleBufferedSubscriber.scala:128)
at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.fastLoop(SimpleBufferedSubscriber.scala:193)
at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.run(SimpleBufferedSubscriber.scala:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: scala/tools/nsc/transform/Transform$class
at d_m.KindRewriter.<init>(KindProjector.scala:22)
at d_m.KindProjector.<init>(KindProjector.scala:18)
... 45 more
Caused by: java.lang.ClassNotFoundException: scala.tools.nsc.transform.Transform$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 47 more
Thanks for reporting!
The ClassNotFoundException: scala.tools.nsc.transform.Transform$class
error seems to indicate a clash with the kind-projector plugin when loading the presentation compiler. The server is currently only compiled against Scala 2.12.4 so that might explain it. We currently don't instantiate a 2.11 compiler instance for 2.11 projects. We should probably document that in beta.md 😅
The API surface we touch from the presentation compiler is quite tiny, it's only 2 methods IIRC so abstracting over it should not be too hard. I have an unmerged commit in https://github.com/olafurpg/language-server/commit/5cfb0bb940d79ea536c76474296caa59bd692e22 that does part of that work The remaining bit would be to classload interactive.Global with the correct version of scala-compiler.
There are a couple more things that would be required to fully support 2.11 projects
Jars.fetch
to get the classpath for scala-compiler with the correct scala-versionIn the meantime, if you are able to use 2.12 then that is the best workaround.
NB, definition/references/scalafix should work for 2.11 projects. This is only affects auto-completions and diagnostics as you type which we currently use the presentation compiler for.
and diagnostics as you type
To further clarify, if you enable the sbt 1.1 integration (there's a setting + a vscode command to trigger it) you're able to have diagnostics as you compile.
To further clarify, if you enable the sbt 1.1 integration (there's a setting + a vscode command to trigger it) you're able to have diagnostics as you compile.
I did enable that setting, sadly didn't notice any effect.
You also need to have a sbt 1.1 running and invoke the Metals: Connect to sbt server
command.
Closing in favor of #201.
Following this discussion on the scalameta gitter :
On a small project, error reporting and auto-completion does not appear to work. A test on another fresh project shows some working features . I'll try to minimise the project that doesn't work and push it to github, but so far here's some potentially useful info :
*vscode version 1.20.1 (1.20.1)
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.4")
libraryDependencies ++= Seq( "com.slamdata" %% "matryoshka-core" % "0.18.3", "org.scalatest" %% "scalatest" % "3.0.2" % "test" )
java.lang.IllegalArgumentException: 1803 is not a valid offset, allowed [0..1801] at org.langmeta.internal.inputs.InternalInput.offsetToLine(InternalInput.scala:42) at org.langmeta.internal.inputs.InternalInput.offsetToLine$(InternalInput.scala:36) at org.langmeta.inputs.Input$VirtualFile.offsetToLine(Input.scala:74) at org.langmeta.inputs.Position$Range.endLine(Position.scala:40) at org.langmeta.languageserver.InputEnrichments$XtensionInputOffset$.toIndexRange$extension(InputEnrichments.scala:32) at scala.meta.metals.search.InMemorySymbolIndex.$anonfun$indexDocument$1(InMemorySymbolIndex.scala:181) at scala.meta.metals.search.InMemorySymbolIndex.$anonfun$indexDocument$1$adapted(InMemorySymbolIndex.scala:169) at scala.collection.Iterator.foreach(Iterator.scala:929) at scala.collection.Iterator.foreach$(Iterator.scala:929) at scala.collection.AbstractIterator.foreach(Iterator.scala:1417) at scala.collection.IterableLike.foreach(IterableLike.scala:71) at scala.collection.IterableLike.foreach$(IterableLike.scala:70) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at scala.meta.metals.search.InMemorySymbolIndex.indexDocument(InMemorySymbolIndex.scala:169) at scala.meta.metals.search.InMemorySymbolIndex.$anonfun$indexDatabase$1(InMemorySymbolIndex.scala:151) at scala.collection.Iterator.foreach(Iterator.scala:929) at scala.collection.Iterator.foreach$(Iterator.scala:929) at scala.collection.AbstractIterator.foreach(Iterator.scala:1417) at scala.collection.IterableLike.foreach(IterableLike.scala:71) at scala.collection.IterableLike.foreach$(IterableLike.scala:70) at scala.collection.AbstractIterable.foreach(Iterable.scala:54) at scala.meta.metals.search.InMemorySymbolIndex.indexDatabase(InMemorySymbolIndex.scala:151) at scala.meta.metals.search.InMemorySymbolIndex.$anonfun$indexDependencyClasspath$7(InMemorySymbolIndex.scala:142) at scala.collection.immutable.List.foreach(List.scala:389) at scala.meta.metals.search.InMemorySymbolIndex.$anonfun$indexDependencyClasspath$6(InMemorySymbolIndex.scala:136) at scala.meta.metals.search.InMemorySymbolIndex.$anonfun$indexDependencyClasspath$6$adapted(InMemorySymbolIndex.scala:135) at scala.meta.metals.storage.LevelDBMap$.withDB(LevelDBMap.scala:85) at scala.meta.metals.search.InMemorySymbolIndex.$anonfun$indexDependencyClasspath$1(InMemorySymbolIndex.scala:135) at monix.eval.internal.TaskRunLoop$.loop$2(TaskRunLoop.scala:321) at monix.eval.internal.TaskRunLoop$.startAsFuture(TaskRunLoop.scala:384) at monix.eval.Task.runAsync(Task.scala:117) at monix.reactive.internal.operators.MapTaskObservable$MapAsyncSubscriber.onNext(MapTaskObservable.scala:190) at monix.reactive.internal.operators.MapOperator$$anon$1.onNext(MapOperator.scala:46) at monix.reactive.internal.operators.DoOnErrorOperator$$anon$1.onNext(DoOnErrorOperator.scala:36) at monix.reactive.subjects.PublishSubject.sendOnNextToAll(PublishSubject.scala:123) at monix.reactive.subjects.PublishSubject.onNext(PublishSubject.scala:97) at monix.reactive.observers.Subscriber$Implementation.onNext(Subscriber.scala:208) at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.signalNext(SimpleBufferedSubscriber.scala:128) at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.fastLoop(SimpleBufferedSubscriber.scala:193) at monix.reactive.observers.buffers.AbstractSimpleBufferedSubscriber$$anon$1.run(SimpleBufferedSubscriber.scala:123) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) 03.679 INFO s.m.m.s.InMemorySymbolIndex - resolveName at Uri(file:///Users/oliviermelois/Downloads/Exercise1/WordChainSolver/src/main/scala/com/pipo/task2/WordChainSolver.scala):37:12 13:15:04.486 INFO s.m.m.s.InMemorySymbolIndex - resolveName at Uri(file:///Users/oliviermelois/Downloads/Exercise1/WordChainSolver/src/main/scala/com/pipo/task2/WordChainSolver.scala):37:14 13:15:05.616 INFO s.m.m.p.DocumentHighlightProvider$ - Document highlight in Uri(file:///Users/oliviermelois/Downloads/Exercise1/WordChainSolver/src/main/scala/com/pipo/task2/WordChainSolver.scala) 13:15:05.616 INFO s.m.m.s.InMemorySymbolIndex - resolveName at Uri(file:///Users/oliviermelois/Downloads/Exercise1/WordChainSolver/src/main/scala/com/pipo/task2/WordChainSolver.scala):28:58 13:16:14.310 INFO s.m.m.MetalsServices - File /Users/oliviermelois/Downloads/Exercise1/WordChainSolver/target/compile.compilerconfig changed, extension=compilerconfig 13:16:14.311 INFO s.m.m.MetalsServices - File /Users/oliviermelois/Downloads/Exercise1/WordChainSolver/target/test.compilerconfig changed, extension=compilerconfig 13:16:14.348 INFO s.m.m.s.InMemorySymbolIndex - Indexing classpath entry /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/src.zip... 13:16:15.865 INFO s.m.m.c.ScalacProvider - Loading new compiler from config CompilerConfig(sources={+2}, scalacOptions=-Xplugin:/Users/oliviermelois/.ivy2/cache/org.spire-math/kind-projector_2.11/jars/kind-projector_2.11-0.9.4.jar, dependencyClasspath={+9}, classDirectory=/Users/oliviermelois/Downloads/Exercise1/WordChainSolver/target/scala-2.11/classes, sourceJars={+76}, origin=/Users/oliviermelois/Downloads/Exercise1/WordChainSolver/target/compile.compilerconfig) 13:16:16.422 INFO s.m.m.s.InMemorySymbolIndex - resolveName at Uri(file:///Users/oliviermelois/Downloads/Exercise1/WordChainSolver/src/main/scala/com/pipo/task2/WordChainSolver.scala):34:32