Skip to content

Commit

Permalink
Merge pull request scala#14555 from ireina7/marker-color-same-as-def-…
Browse files Browse the repository at this point in the history
…name

improvement(repl): end marker now has the same color as its definition in repl (fix scala#14535)
  • Loading branch information
bishabosha authored Mar 14, 2022
2 parents 83fb072 + 1081d62 commit 30ce9a5
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ object SyntaxHighlighting {
case tree: ValOrDefDef =>
highlightAnnotations(tree)
highlightPosition(tree.nameSpan, ValDefColor)
highlightPosition(tree.endSpan, ValDefColor)
case tree: MemberDef /* ModuleDef | TypeDef */ =>
highlightAnnotations(tree)
highlightPosition(tree.nameSpan, TypeColor)
highlightPosition(tree.endSpan, TypeColor)
case tree: Ident if tree.isType =>
highlightPosition(tree.span, TypeColor)
case _: TypeTree =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,5 +140,41 @@ class SyntaxHighlightingTests extends DottyTest {
test("val inline = 2", "<K|val> <V|inline> = <L|2>")
test("def inline = 2", "<K|def> <V|inline> = <L|2>")
test("def foo(inline: Int) = 2", "<K|def> <V|foo>(<V|inline>: <T|Int>) = <L|2>")
test(
"""enum Foo:
| case foo
|end Foo""".stripMargin,
"""<K|enum> <T|Foo>:
| <K|case> <T|foo>
|<K|end> <T|Foo>""".stripMargin
)
test(
"""class Foo:
|end Foo""".stripMargin,
"""<K|class> <T|Foo>:
|<K|end> <T|Foo>""".stripMargin
)
test(
"""object Foo:
|end Foo""".stripMargin,
"""<K|object> <T|Foo>:
|<K|end> <T|Foo>""".stripMargin
)
test(
"""def foo =
| ()
|end foo""".stripMargin,
"""<K|def> <V|foo> =
| ()
|<K|end> <V|foo>""".stripMargin
)
test(
"""val foo =
| ()
|end foo""".stripMargin,
"""<K|val> <V|foo> =
| ()
|<K|end> <V|foo>""".stripMargin
)
}
}

0 comments on commit 30ce9a5

Please sign in to comment.