Skip to content

Commit 80cb6ce

Browse files
committed
[FEATURE] skip comment lines, e.g. for structure view & table editor
1 parent b847b35 commit 80cb6ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvHelper.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ public static CsvColumnInfoMap<PsiElement> createColumnInfoMap(CsvFile csvFile)
203203
int row = 0;
204204
boolean hasComments = false;
205205
for (CsvRecord record : records) {
206+
// skip comment records
207+
if (record.getComment() != null) {
208+
hasComments = true;
209+
continue;
210+
}
206211
int column = 0;
207212
for (CsvField field : record.getFieldList()) {
208213
Integer length = CsvHelper.getMaxTextLineLength(unquoteCsvValue(field.getText(), escapeCharacter));
@@ -214,9 +219,6 @@ public static CsvColumnInfoMap<PsiElement> createColumnInfoMap(CsvFile csvFile)
214219
columnInfoMap.get(column).addElement(field, row, getFieldStartOffset(field), getFieldEndOffset(field));
215220
++column;
216221
}
217-
if (record.getComment() != null) {
218-
hasComments = true;
219-
}
220222
++row;
221223
}
222224
return new CsvColumnInfoMap(columnInfoMap, PsiTreeUtil.hasErrorElements(csvFile), hasComments);

0 commit comments

Comments
 (0)