Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit db1814c

Browse files
author
fc
committed
Updated to Ensime 2.0.0. Using TypeInfo.name and TypeInfo.fullName for Hover
1 parent 34ba771 commit db1814c

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ lazy val `ensime-lsp` = project.
6363
settings(
6464
resolvers += Resolver.sonatypeRepo("snapshots"),
6565
libraryDependencies ++= Seq(
66-
"org.ensime" %% "core" % "2.0.0-M4"
66+
"org.ensime" %% "core" % "2.0.0"
6767
),
6868
pomExtra in Global := {
6969
<url>https://github.com/dragos/dragos-vscode-scala/</url>

ensime-lsp/src/main/scala/org/github/dragos/vscode/EnsimeLanguageServer.scala

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -262,34 +262,34 @@ class EnsimeLanguageServer(in: InputStream, out: OutputStream) extends LanguageS
262262
import scala.concurrent.ExecutionContext.Implicits._
263263
logger.info(s"Got hover request at (${position.line}, ${position.character}).")
264264

265-
// val res = for (doc <- documentManager.documentForUri(textDocument.uri)) yield {
266-
// val pos = doc.positionToOffset(position)
267-
// val future = ensimeActor ? TypeAtPointReq(
268-
// Right(toSourceFileInfo(textDocument.uri, Some(new String(doc.contents)))),
269-
// OffsetRange(pos, pos))
270-
271-
// future.onComplete { f => logger.debug(s"Goto Definition future completed: succes? ${f.isSuccess}") }
272-
273-
// future.map {
274-
// case typeInfo: TypeInfo =>
275-
// logger.info(s"Retrieved typeInfo $typeInfo")
276-
// Hover(Seq(RawMarkedString("scala", typeInfo.toString)), Some(Range(position, position)))
277-
// }
278-
// }
279265
val res = for (doc <- documentManager.documentForUri(textDocument.uri)) yield {
280-
val future = ensimeActor ? DocUriAtPointReq(
266+
val pos = doc.positionToOffset(position)
267+
val future = ensimeActor ? TypeAtPointReq(
281268
Right(toSourceFileInfo(textDocument.uri, Some(new String(doc.contents)))),
282-
OffsetRange(doc.positionToOffset(position)))
269+
OffsetRange(pos, pos))
283270

284-
future.onComplete { f => logger.debug(s"DocUriAtPointReq future completed: succes? ${f.isSuccess}") }
271+
future.onComplete { f => logger.debug(s"Goto Definition future completed: succes? ${f.isSuccess}") }
285272

286273
future.map {
287-
case Some(sigPair @ DocSigPair(DocSig(_, scalaSig), DocSig(_, javaSig))) =>
288-
val sig = scalaSig.orElse(javaSig).getOrElse("")
289-
logger.info(s"Retrieved signature $sig from @sigPair")
290-
Hover(Seq(RawMarkedString("scala", sig)), Some(Range(position, position)))
274+
case typeInfo: TypeInfo =>
275+
logger.info(s"Retrieved typeInfo $typeInfo")
276+
Hover(Seq(RawMarkedString("scala", typeInfo.name +"\n"+ typeInfo.fullName)), Some(Range(position, position)))
291277
}
292278
}
279+
// val res = for (doc <- documentManager.documentForUri(textDocument.uri)) yield {
280+
// val future = ensimeActor ? DocUriAtPointReq(
281+
// Right(toSourceFileInfo(textDocument.uri, Some(new String(doc.contents)))),
282+
// OffsetRange(doc.positionToOffset(position)))
283+
284+
// future.onComplete { f => logger.debug(s"DocUriAtPointReq future completed: succes? ${f.isSuccess}") }
285+
286+
// future.map {
287+
// case Some(sigPair @ DocSigPair(DocSig(_, scalaSig), DocSig(_, javaSig))) =>
288+
// val sig = scalaSig.orElse(javaSig).getOrElse("")
289+
// logger.info(s"Retrieved signature $sig from @sigPair")
290+
// Hover(Seq(RawMarkedString("scala", sig)), Some(Range(position, position)))
291+
// }
292+
// }
293293
res.map { f => Await.result(f, 5 seconds) } getOrElse Hover(Nil, None)
294294
}
295295

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
addSbtPlugin("org.ensime" % "sbt-ensime" % "1.12.0")
1+
addSbtPlugin("org.ensime" % "sbt-ensime" % "2.0.1")
22

33
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
44

0 commit comments

Comments
 (0)