summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interpreter/IdentCompletion.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/IdentCompletion.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/IdentCompletion.scala25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IdentCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/IdentCompletion.scala
new file mode 100644
index 0000000000..b0152dbbc6
--- /dev/null
+++ b/src/compiler/scala/tools/nsc/interpreter/IdentCompletion.scala
@@ -0,0 +1,25 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2010 LAMP/EPFL
+ * @author Paul Phillips
+ */
+
+package scala.tools.nsc
+package interpreter
+
+/** Top level identifiers visible in the repl. It immediately
+ * delegates to an InstanceCompletion.
+ */
+class IdentCompletion(repl: Interpreter) extends CompletionAware {
+ val INTERPRETER_VAR_PREFIX = "res"
+
+ def completions() = repl.unqualifiedIds ::: List("classOf")
+ override def follow(id: String) =
+ // XXX this will be nice but needs solidifying.
+ // (repl completionAwareImplicit id) orElse
+ if (completions contains id) {
+ (repl completionAware id) orElse {
+ repl clazzForIdent id map (x => new InstanceCompletion(x))
+ }
+ }
+ else None
+}