3
3
import com .intellij .lang .annotation .*;
4
4
import com .intellij .openapi .editor .markup .TextAttributes ;
5
5
import com .intellij .openapi .util .Key ;
6
- import com .intellij .openapi .util .TextRange ;
7
6
import com .intellij .openapi .vcs .ui .FontUtil ;
8
7
import com .intellij .psi .PsiElement ;
9
8
import com .intellij .psi .tree .IElementType ;
@@ -60,18 +59,17 @@ public void annotate(@NotNull final PsiElement element, @NotNull final Annotatio
60
59
)
61
60
);
62
61
}
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
- }
67
62
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 ();
75
73
}
76
74
}
77
75
@@ -98,10 +96,11 @@ protected boolean handleSeparatorElement(@NotNull PsiElement element, @NotNull A
98
96
}
99
97
}
100
98
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 ();
105
104
}
106
105
return true ;
107
106
}
0 commit comments