diff options
author | som-snytt <som.snytt@gmail.com> | 2016-04-15 01:28:18 -0700 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2016-04-15 10:28:18 +0200 |
commit | 804a4cc1ff9fa159c576be7c685dbb81220c11da (patch) | |
tree | 1ce5cf263d27ac62735ca03d37e67d93ca4498d3 /src | |
parent | d6f66ec0f38e42c19f79cbe9d32d29c65dee1e05 (diff) | |
download | scala-804a4cc1ff9fa159c576be7c685dbb81220c11da.tar.gz scala-804a4cc1ff9fa159c576be7c685dbb81220c11da.tar.bz2 scala-804a4cc1ff9fa159c576be7c685dbb81220c11da.zip |
SI-9749 REPL strip lead ws on dot continuation (#5097)
Permit leading whitespace before `.` for continued selection.
This is just to handle pastes, which will typically include
indented text, and not to make dot-continuation especially robust.
Diffstat (limited to 'src')
-rw-r--r-- | src/repl/scala/tools/nsc/interpreter/Completion.scala | 14 |
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 + } } |