33import com .intellij .lang .annotation .*;
44import com .intellij .openapi .editor .markup .TextAttributes ;
55import com .intellij .openapi .util .Key ;
6- import com .intellij .openapi .util .TextRange ;
76import com .intellij .openapi .vcs .ui .FontUtil ;
87import com .intellij .psi .PsiElement ;
98import com .intellij .psi .tree .IElementType ;
@@ -60,18 +59,17 @@ public void annotate(@NotNull final PsiElement element, @NotNull final Annotatio
6059 )
6160 );
6261 }
63- TextRange textRange = columnInfo .getRowInfo (element ).getTextRange ();
64- if (textRange .getStartOffset () - csvFile .getTextLength () == 0 && textRange .getStartOffset () > 0 ) {
65- textRange = TextRange .from (textRange .getStartOffset () - 1 , 1 );
66- }
6762
68- final Annotation annotation = holder .createAnnotation (CSV_COLUMN_INFO_SEVERITY , textRange , message , tooltip );
69- annotation .setEnforcedTextAttributes (
70- CsvEditorSettings .getInstance ().getValueColoring () == CsvEditorSettings .ValueColoring .RAINBOW ?
71- CsvColorSettings .getTextAttributesOfColumn (columnInfo .getColumnIndex (), holder .getCurrentAnnotationSession ()) :
72- null
73- );
74- annotation .setNeedsUpdateOnTyping (false );
63+ holder .newAnnotation (CSV_COLUMN_INFO_SEVERITY , message )
64+ .range (element )
65+ .tooltip (tooltip )
66+ .enforcedTextAttributes (
67+ CsvEditorSettings .getInstance ().getValueColoring () == CsvEditorSettings .ValueColoring .RAINBOW ?
68+ CsvColorSettings .getTextAttributesOfColumn (columnInfo .getColumnIndex (), holder .getCurrentAnnotationSession ()) :
69+ null
70+ )
71+ .needsUpdateOnTyping (false )
72+ .create ();
7573 }
7674 }
7775
@@ -98,10 +96,11 @@ protected boolean handleSeparatorElement(@NotNull PsiElement element, @NotNull A
9896 }
9997 }
10098 if (textAttributes != null ) {
101- final TextRange textRange = element .getTextRange ();
102- final Annotation annotation = holder .createAnnotation (CSV_COLUMN_INFO_SEVERITY , textRange , showInfoBalloon (holder .getCurrentAnnotationSession ()) ? "↹" : null );
103- annotation .setEnforcedTextAttributes (textAttributes );
104- annotation .setNeedsUpdateOnTyping (false );
99+ holder .newAnnotation (CSV_COLUMN_INFO_SEVERITY , showInfoBalloon (holder .getCurrentAnnotationSession ()) ? "↹" : null )
100+ .range (element )
101+ .enforcedTextAttributes (textAttributes )
102+ .needsUpdateOnTyping (false )
103+ .create ();
105104 }
106105 return true ;
107106 }
0 commit comments