77 */
88package com .intellij .lang .jsgraphql .ide .highlighting ;
99
10+ import com .intellij .codeInsight .daemon .impl .HighlightInfoType ;
1011import com .intellij .lang .annotation .Annotation ;
1112import com .intellij .lang .annotation .AnnotationHolder ;
1213import com .intellij .lang .annotation .Annotator ;
@@ -88,7 +89,7 @@ public void visitFieldDefinition(@NotNull GraphQLFieldDefinition fieldDefinition
8889 @ Override
8990 public void visitInputValueDefinition (@ NotNull GraphQLInputValueDefinition element ) {
9091 // first reset the bold font display from keywords such as input/type being used as field name
91- resetAttributes (element .getNameIdentifier (), holder );
92+ resetAttributes (element .getNameIdentifier ());
9293
9394 final GraphQLArgumentsDefinition arguments = PsiTreeUtil .getParentOfType (element , GraphQLArgumentsDefinition .class );
9495 if (arguments != null ) {
@@ -103,7 +104,7 @@ public void visitInputValueDefinition(@NotNull GraphQLInputValueDefinition eleme
103104 @ Override
104105 public void visitArgument (@ NotNull GraphQLArgument argument ) {
105106 // first reset the bold font display from keywords such as input/type being used as argument name
106- resetAttributes (argument .getNameIdentifier (), holder );
107+ resetAttributes (argument .getNameIdentifier ());
107108
108109 // then apply argument font style
109110 applyTextAttributes (argument .getNameIdentifier (), ARGUMENT );
@@ -146,22 +147,27 @@ public void visitDirective(@NotNull GraphQLDirective directive) {
146147 @ Override
147148 public void visitObjectField (@ NotNull GraphQLObjectField objectField ) {
148149 // first reset the bold font display from keywords such as input/type being used as object field name
149- resetAttributes (objectField .getNameIdentifier (), holder );
150+ resetAttributes (objectField .getNameIdentifier ());
150151
151152 // then apply argument font style
152153 applyTextAttributes (objectField .getNameIdentifier (), ARGUMENT );
153154 }
154155
155156 private void applyTextAttributes (@ Nullable PsiElement element , @ NotNull TextAttributesKey attributes ) {
156157 if (element == null ) return ;
157- Annotation annotation = holder .createInfoAnnotation (element , null );
158+
159+ Annotation annotation =
160+ holder .createAnnotation (HighlightInfoType .SYMBOL_TYPE_SEVERITY , element .getTextRange (), null );
158161 annotation .setTextAttributes (attributes );
159162 }
160- });
161- }
162163
163- private void resetAttributes (@ NotNull PsiElement element , @ NotNull AnnotationHolder holder ) {
164- Annotation annotation = holder .createInfoAnnotation (element , null );
165- annotation .setEnforcedTextAttributes (TextAttributes .ERASE_MARKER );
164+ private void resetAttributes (@ Nullable PsiElement element ) {
165+ if (element == null ) return ;
166+
167+ Annotation annotation =
168+ holder .createAnnotation (HighlightInfoType .SYMBOL_TYPE_SEVERITY , element .getTextRange (), null );
169+ annotation .setEnforcedTextAttributes (TextAttributes .ERASE_MARKER );
170+ }
171+ });
166172 }
167173}
0 commit comments