Skip to content

Commit ba857e8

Browse files
committed
Fix "Exception when Show info balloon is not selected"
1 parent 9b38099 commit ba857e8

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/CsvAnnotator.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,18 @@ public void annotate(@NotNull final PsiElement element, @NotNull final Annotatio
6060
);
6161
}
6262

63-
holder.newAnnotation(CSV_COLUMN_INFO_SEVERITY, message)
63+
AnnotationBuilder annotationBuilder = holder.newAnnotation(CSV_COLUMN_INFO_SEVERITY, message)
6464
.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();
65+
.needsUpdateOnTyping(false);
66+
67+
if (CsvEditorSettings.getInstance().getValueColoring() == CsvEditorSettings.ValueColoring.RAINBOW) {
68+
annotationBuilder.enforcedTextAttributes(CsvColorSettings.getTextAttributesOfColumn(columnInfo.getColumnIndex(), holder.getCurrentAnnotationSession()));
69+
}
70+
if (tooltip != null) {
71+
annotationBuilder.tooltip(tooltip);
72+
}
73+
74+
annotationBuilder.create();
7375
}
7476
}
7577

@@ -95,8 +97,8 @@ protected boolean handleSeparatorElement(@NotNull PsiElement element, @NotNull A
9597
holder.getCurrentAnnotationSession().putUserData(TAB_SEPARATOR_HIGHLIGHT_COLOR_DETERMINED_KEY, Boolean.TRUE);
9698
}
9799
}
98-
if (textAttributes != null) {
99-
holder.newAnnotation(CSV_COLUMN_INFO_SEVERITY, showInfoBalloon(holder.getCurrentAnnotationSession()) ? "↹" : null)
100+
if (textAttributes != null && showInfoBalloon(holder.getCurrentAnnotationSession())) {
101+
holder.newAnnotation(CSV_COLUMN_INFO_SEVERITY, "↹")
100102
.range(element)
101103
.enforcedTextAttributes(textAttributes)
102104
.needsUpdateOnTyping(false)

0 commit comments

Comments
 (0)