summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interpreter/IdentCompletion.scala
blob: b0152dbbc662d76d576bf15b9c72d434f237d8a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
}