dragos / dragos-vscode-scala

Other
253 stars 39 forks source link

Compiles and run on Scala 2.12, latest version of Ensime (2.0.0-M4). Added settings to change server log level from VSCode #54

Closed fede0664 closed 7 years ago

fede0664 commented 7 years ago
dragos commented 7 years ago

I just noticed that Document Symbols stopped working. I see these errors in the log, perhaps related to the upgrade to scala-json-rpc 2.0?

[2017-09-11 14:34:55,435] DEBUG org.github.dragos.vscode.EnsimeLanguageServer - got back: List(StructureViewMember(class,Hello,OffsetSourcePosition(RawFile(/Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala),8),List(StructureViewMember(def,foo,OffsetSourcePosition(RawFile(/Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala),22),List()), StructureViewMember(type,X,OffsetSourcePosition(RawFile(/Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala),135),List()))))
[2017-09-11 14:34:55,435] DEBUG org.github.dragos.vscode.EnsimeLanguageServer - got back: List(StructureViewMember(class,Hello,OffsetSourcePosition(RawFile(/Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala),8),List(StructureViewMember(def,foo,OffsetSourcePosition(RawFile(/Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala),22),List()), StructureViewMember(type,X,OffsetSourcePosition(RawFile(/Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala),135),List()))))
[2017-09-11 14:34:55,437] INFO langserver.core.Connection - Result:DocumentSymbolResult(List(SymbolInformation(Hello,5,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(2,6),Position(2,11))),None), SymbolInformation(foo,6,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(3,6),Position(3,9))),Some(Hello)), SymbolInformation(X,11,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(11,7),Position(11,8))),Some(Hello))))
[2017-09-11 14:34:55,437] INFO langserver.core.Connection - Result:DocumentSymbolResult(List(SymbolInformation(Hello,5,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(2,6),Position(2,11))),None), SymbolInformation(foo,6,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(3,6),Position(3,9))),Some(Hello)), SymbolInformation(X,11,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(11,7),Position(11,8))),Some(Hello))))
[2017-09-11 14:34:55,441] ERROR langserver.core.Connection - ResultResponse.write:DocumentSymbolResult(List(SymbolInformation(Hello,5,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(2,6),Position(2,11))),None), SymbolInformation(foo,6,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(3,6),Position(3,9))),Some(Hello)), SymbolInformation(X,11,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(11,7),Position(11,8))),Some(Hello))))
[2017-09-11 14:34:55,441] ERROR langserver.core.Connection - ResultResponse.write:DocumentSymbolResult(List(SymbolInformation(Hello,5,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(2,6),Position(2,11))),None), SymbolInformation(foo,6,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(3,6),Position(3,9))),Some(Hello)), SymbolInformation(X,11,Location(file:///Users/dragos/workspace/oss/test-code/src/main/scala/Hello.scala,Range(Position(11,7),Position(11,8))),Some(Hello))))

it looks like the error is a Json validation error, I wonder why...

play.api.libs.json.JsResultException: JsResultException(errors:List((,List(JsonValidationError(List(error.expected.jsobject),WrappedArray())))))
    at play.api.libs.json.JsReadable.$anonfun$as$2(JsReadable.scala:24)
    at play.api.libs.json.JsError.fold(JsResult.scala:55)
    at play.api.libs.json.JsReadable.as(JsReadable.scala:23)
    at play.api.libs.json.JsReadable.as$(JsReadable.scala:22)
    at play.api.libs.json.JsArray.as(JsValue.scala:93)
    at langserver.utils.JsonRpcUtils$$anon$1.writes(JsonRpcUtils.scala:39)
    at com.dhpcs.jsonrpc.ResponseCompanion.write(MessageCompanions.scala:56)
    at com.dhpcs.jsonrpc.ResponseCompanion.write$(MessageCompanions.scala:52)
    at langserver.messages.ResultResponse$.write(Commands.scala:253)
    at langserver.core.Connection.$anonfun$handleCommand$3(Connection.scala:168)
    at scala.util.Try$.apply(Try.scala:209)
    at langserver.core.Connection.$anonfun$handleCommand$2(Connection.scala:166)
    at langserver.core.Connection.$anonfun$handleCommand$2$adapted(Connection.scala:163)
    at scala.util.Success.$anonfun$map$1(Try.scala:251)
    at scala.util.Success.map(Try.scala:209)
    at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
    at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
    at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
dragos commented 7 years ago

Fantastic, thanks a lot! Merging this.

jvican commented 7 years ago

Yay!! You cannot imagine the atrocities I've done to my 2.12 build to support the vscode integration for scalac-performance here: https://github.com/scalacenter/scalac-profiling.

dhpiggott commented 7 years ago

Hey. scala-json-rpc author here. I see now from looking over this (found it via https://twitter.com/jaguarul/status/907514621728260096) that this was a regression in scala-json-rpc 2.0.0.

I've just fixed it via https://github.com/dhpcs/scala-json-rpc/pull/48 and released the fixed version as 2.0.1, so it should be possible now to update dragos-vscode-scala and remove these workarounds.

dragos commented 7 years ago

Thank you @dhpiggott! Open-source at its finest!