Skip to content

Commit 3939df8

Browse files
committed
Fix #3814 Correct highlighting after '|', ':' characters in REPL
1 parent 7862aaf commit 3939df8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/printing/SyntaxHighlighting.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ object SyntaxHighlighting {
4343
'q' :: 'r' :: 's' :: 't' :: 'u' :: 'v' :: 'w' :: 'x' :: 'y' :: 'z' :: Nil
4444

4545
private val typeEnders =
46-
'{' :: '}' :: ')' :: '(' :: '[' :: ']' :: '=' :: ' ' :: ',' :: '.' ::
46+
'{' :: '}' :: ')' :: '(' :: '[' :: ']' :: '=' :: ' ' :: ',' :: '.' :: '|' ::
4747
'\n' :: Nil
4848

4949
def apply(chars: Iterable[Char]): Iterable[Char] = {
@@ -54,7 +54,8 @@ object SyntaxHighlighting {
5454

5555
@inline def keywordStart =
5656
prev == 0 || prev == ' ' || prev == '{' || prev == '(' ||
57-
prev == '\n' || prev == '[' || prev == ','
57+
prev == '\n' || prev == '[' || prev == ',' || prev == ':' ||
58+
prev == '|'
5859

5960
@inline def numberStart(c: Char) =
6061
c.isDigit && (!prev.isLetter || prev == '.' || prev == ' ' || prev == '(' || prev == '\u0000')

0 commit comments

Comments
 (0)