diff --git a/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala b/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala index 8a79e1ddc263..67aa24243ab6 100644 --- a/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala +++ b/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala @@ -77,10 +77,15 @@ object SyntaxHighlighting { (n: @switch) match { case '/' => if (remaining.nonEmpty) { - takeChar() match { - case '/' => eolComment() - case '*' => blockComment() - case x => newBuf += '/'; remaining = x #:: remaining + remaining.head match { + case '/' => + takeChar() + eolComment() + case '*' => + takeChar() + blockComment() + case x => + newBuf += '/' } } else newBuf += '/' case '=' =>