File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
src/dotty/tools/dotc/printing
test/dotty/tools/dotc/printing Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -109,9 +109,11 @@ object SyntaxHighlighting {
109109 case tree : ValOrDefDef =>
110110 highlightAnnotations(tree)
111111 highlightPosition(tree.nameSpan, ValDefColor )
112+ highlightPosition(tree.endSpan, ValDefColor )
112113 case tree : MemberDef /* ModuleDef | TypeDef */ =>
113114 highlightAnnotations(tree)
114115 highlightPosition(tree.nameSpan, TypeColor )
116+ highlightPosition(tree.endSpan, TypeColor )
115117 case tree : Ident if tree.isType =>
116118 highlightPosition(tree.span, TypeColor )
117119 case _ : TypeTree =>
Original file line number Diff line number Diff line change @@ -140,5 +140,41 @@ class SyntaxHighlightingTests extends DottyTest {
140140 test(" val inline = 2" , " <K|val> <V|inline> = <L|2>" )
141141 test(" def inline = 2" , " <K|def> <V|inline> = <L|2>" )
142142 test(" def foo(inline: Int) = 2" , " <K|def> <V|foo>(<V|inline>: <T|Int>) = <L|2>" )
143+ test(
144+ """ enum Foo:
145+ | case foo
146+ |end Foo""" .stripMargin,
147+ """ <K|enum> <T|Foo>:
148+ | <K|case> <T|foo>
149+ |<K|end> <T|Foo>""" .stripMargin
150+ )
151+ test(
152+ """ class Foo:
153+ |end Foo""" .stripMargin,
154+ """ <K|class> <T|Foo>:
155+ |<K|end> <T|Foo>""" .stripMargin
156+ )
157+ test(
158+ """ object Foo:
159+ |end Foo""" .stripMargin,
160+ """ <K|object> <T|Foo>:
161+ |<K|end> <T|Foo>""" .stripMargin
162+ )
163+ test(
164+ """ def foo =
165+ | ()
166+ |end foo""" .stripMargin,
167+ """ <K|def> <V|foo> =
168+ | ()
169+ |<K|end> <V|foo>""" .stripMargin
170+ )
171+ test(
172+ """ val foo =
173+ | ()
174+ |end foo""" .stripMargin,
175+ """ <K|val> <V|foo> =
176+ | ()
177+ |<K|end> <V|foo>""" .stripMargin
178+ )
143179 }
144180}
You can’t perform that action at this time.
0 commit comments