File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -91,18 +91,23 @@ object SyntaxHighlighting {
9191 name == nme.ERROR || name == nme.CONSTRUCTOR
9292 }
9393
94+ def highlightAnnotations (tree : MemberDef ): Unit =
95+ for (annotation <- tree.rawMods.annotations)
96+ highlightPosition(annotation.pos, AnnotationColor )
97+
9498 def highlight (trees : List [Tree ])(implicit ctx : Context ): Unit =
9599 trees.foreach(traverse)
96100
97101 def traverse (tree : Tree )(implicit ctx : Context ): Unit = {
98102 tree match {
99103 case tree : NameTree if ignored(tree) =>
100104 ()
101- case tree : MemberDef /* ValOrDefDef | ModuleDef | TypeDef */ =>
102- for (annotation <- tree.rawMods.annotations)
103- highlightPosition(annotation.pos, AnnotationColor )
104- val color = if (tree.isInstanceOf [ValOrDefDef ]) ValDefColor else TypeColor
105- highlightPosition(tree.namePos, color)
105+ case tree : ValOrDefDef =>
106+ highlightAnnotations(tree)
107+ highlightPosition(tree.namePos, ValDefColor )
108+ case tree : MemberDef /* ModuleDef | TypeDef */ =>
109+ highlightAnnotations(tree)
110+ highlightPosition(tree.namePos, TypeColor )
106111 case tree : Ident if tree.isType =>
107112 highlightPosition(tree.pos, TypeColor )
108113 case _ : TypTree =>
You can’t perform that action at this time.
0 commit comments