File tree 3 files changed +8
-6
lines changed
compiler/src/dotty/tools/dotc
3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
346
346
case id : Trees .SearchFailureIdent [_] =>
347
347
tree.typeOpt match {
348
348
case reason : Implicits .SearchFailureType =>
349
- toText(id.name) ~ " implicitly" ~ toText(reason.expectedType) ~ " ]"
349
+ toText(id.name) ~ " implicitly[ " ~ toText(reason.expectedType) ~ " ]"
350
350
case _ =>
351
351
toText(id.name)
352
352
}
@@ -411,7 +411,7 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
411
411
if (sel.isEmpty) blockText(cases)
412
412
else changePrec(GlobalPrec ) { toText(sel) ~ keywordStr(" match " ) ~ blockText(cases) }
413
413
case CaseDef (pat, guard, body) =>
414
- keywordStr(" case " ) ~ inPattern(toText(pat)) ~ optText(guard)(" if " ~ _) ~ " => " ~ caseBlockText(body)
414
+ keywordStr(" case " ) ~ inPattern(toText(pat)) ~ optText(guard)(keywordStr( " if " ) ~ _) ~ " => " ~ caseBlockText(body)
415
415
case Return (expr, from) =>
416
416
changePrec(GlobalPrec ) { keywordStr(" return" ) ~ optText(expr)(" " ~ _) }
417
417
case Try (expr, cases, finalizer) =>
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ object SyntaxHighlighting {
17
17
val KeywordColor = Console .YELLOW
18
18
val ValDefColor = Console .CYAN
19
19
val LiteralColor = Console .RED
20
- val StringColor = Console .GREEN
20
+ val StringColor = Console .GREEN
21
21
val TypeColor = Console .MAGENTA
22
22
val AnnotationColor = Console .MAGENTA
23
23
Original file line number Diff line number Diff line change @@ -7,23 +7,25 @@ object DiffUtil {
7
7
8
8
val EOF = new String (" EOF" ) // Unique string up to reference
9
9
10
+ val ansiColorToken = '\u001b '
11
+
10
12
@ tailrec private def splitTokens (str : String , acc : List [String ] = Nil ): List [String ] = {
11
13
if (str == " " ) {
12
14
acc.reverse
13
15
} else {
14
16
val head = str.charAt(0 )
15
17
val (token, rest) =
16
- if (head == ' \u001b ' ) { // ansi color token
18
+ if (head == ansiColorToken ) { // ansi color token
17
19
val splitIndex = str.indexOf('m' ) + 1
18
20
(str.substring(0 , splitIndex), str.substring(splitIndex))
19
21
} else if (Character .isAlphabetic(head) || Character .isDigit(head)) {
20
- str.span(c => Character .isAlphabetic(c) || Character .isDigit(c) && c != ' \u001b ' )
22
+ str.span(c => Character .isAlphabetic(c) || Character .isDigit(c) && c != ansiColorToken )
21
23
} else if (Character .isMirrored(head) || Character .isWhitespace(head)) {
22
24
str.splitAt(1 )
23
25
} else {
24
26
str.span { c =>
25
27
! Character .isAlphabetic(c) && ! Character .isDigit(c) &&
26
- ! Character .isMirrored(c) && ! Character .isWhitespace(c) && c != ' \u001b '
28
+ ! Character .isMirrored(c) && ! Character .isWhitespace(c) && c != ansiColorToken
27
29
}
28
30
}
29
31
splitTokens(rest, token :: acc)
You can’t perform that action at this time.
0 commit comments