summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.classpath2
-rw-r--r--META-INF/MANIFEST.MF3
-rwxr-xr-xsrc/compiler/scala/tools/nsc/interactive/Global.scala28
3 files changed, 30 insertions, 3 deletions
diff --git a/.classpath b/.classpath
index bb255263fc..1e83ae27e7 100644
--- a/.classpath
+++ b/.classpath
@@ -5,6 +5,6 @@
<classpathentry kind="lib" path="lib/msil.jar"/>
<classpathentry kind="lib" path="lib/jline.jar"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="lib" path="lib/fjbg.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/fjbg.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 7442856cd6..8300fde1bf 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -23,7 +23,8 @@ Export-Package:
scala.tools.nsc.symtab,
scala.tools.nsc.symtab.classfile,
scala.tools.nsc.typechecker,
- scala.tools.nsc.util
+ scala.tools.nsc.util,
+ ch.epfl.lamp.fjbg
Require-Bundle:
org.apache.ant,
scala.library
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 029a98cb10..e6993f5000 100755
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -1,6 +1,9 @@
package scala.tools.nsc.interactive
+import java.io.{ PrintWriter, StringWriter }
+
import scala.collection.mutable.{LinkedHashMap, SynchronizedMap}
+import scala.concurrent.SyncVar
import scala.tools.nsc.io.AbstractFile
import scala.tools.nsc.util.{SourceFile, Position, RangePosition, OffsetPosition, NoPosition, WorkScheduler}
import scala.tools.nsc.reporters._
@@ -125,7 +128,30 @@ self =>
}
}
- def hoverInfo(): String = ""
+ def debugInfo(source : SourceFile, start : Int, length : Int): String = {
+ val end = start+length
+ val pos = rangePos(source, start, start, end)
+
+ val tree = locateTree(pos)
+ val sw = new StringWriter
+ val pw = new PrintWriter(sw)
+ treePrinters.create(pw).print(tree)
+ pw.flush
+
+ val typed = new SyncVar[Either[Tree, Throwable]]
+ askTypeAt(pos, typed)
+ val typ = typed.get.left.toOption match {
+ case Some(tree) =>
+ val sw = new StringWriter
+ val pw = new PrintWriter(sw)
+ treePrinters.create(pw).print(tree)
+ pw.flush
+ sw.toString
+ case None => "<None>"
+ }
+
+ source.content.view.drop(start).take(length).mkString+" : "+source.path+" ("+start+", "+end+")\n\nlocateTree:\n"+sw.toString+"\n\naskTypeAt:\n"+typ
+ }
// ----------------- The Background Runner Thread -----------------------