summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/repl/scala/tools/nsc/interpreter/Completion.scala14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/repl/scala/tools/nsc/interpreter/Completion.scala b/src/repl/scala/tools/nsc/interpreter/Completion.scala
index 3d0b9a975c..6f5194d2f9 100644
--- a/src/repl/scala/tools/nsc/interpreter/Completion.scala
+++ b/src/repl/scala/tools/nsc/interpreter/Completion.scala
@@ -24,11 +24,11 @@ object Completion {
case class Candidates(cursor: Int, candidates: List[String]) { }
val NoCandidates = Candidates(-1, Nil)
- def looksLikeInvocation(code: String) = (
- (code != null)
- && (code startsWith ".")
- && !(code == ".")
- && !(code startsWith "./")
- && !(code startsWith "..")
- )
+ // a leading dot plus something, but not ".." or "./", ignoring leading whitespace
+ private val dotlike = """\s*\.[^./].*""".r
+ def looksLikeInvocation(code: String) = code match {
+ case null => false // insurance
+ case dotlike() => true
+ case _ => false
+ }
}