mechatroner / vscode_rainbow_csv

🌈Rainbow CSV - VS Code extension: Highlight CSV and TSV files in different rainbow colors to make them more readable
MIT License
432 stars 53 forks source link

Extension Ignores CSV DOM #163

Closed Alfetta159 closed 8 months ago

Alfetta159 commented 8 months ago

The Extension seems to ignore CSV rules where a line feed in quotes is not ignored in terms of the CSV document model:

Column1,Column2
"Dead","Beef"
"There he is.","That
rascally rabbit.","Be very\" quiet"

Rainbow CSV doesn't colorize line 4 correctly. 'rascally rabbit is part of the second column of line 3 and therefore should be blue. image

Excel is able to correctly import the file keeping the field with the linefeed in a single cell (B3): image

mechatroner commented 8 months ago

I haven't checked but it doesn't work most likely because in your file the double quote in the last field is escaped with a backslash char, while the more common and standard way of escaping a double quote character is using two consecutive double quotes, see https://www.ietf.org/rfc/rfc4180.txt. Because backslash escaping is not very popular these days, Rainbow CSV doesn't support it (currently), but multiline fields are supported via "dynamic csv" filetype, please see the README file.
BTW it looks like even Excel hasn't parsed this example correctly - in cell C3 it should be Be very" quiet and not Be very\ quiet".

mechatroner commented 8 months ago

Marking as duplicate to #91

Alfetta159 commented 8 months ago

@mechatroner , No, that's not why. As we can see here, without the delimited quote, we still see the same thing:

image

In the example and in terms of the CSV DOM, there are two lines here, each w/ three columns and there is a header.

mechatroner commented 8 months ago

Please try to switch the filetype to "dynamic csv" in the bottom right corner and set separator to comma , - typically if a file is big enough it would autodetect it, but since this example only has 4 lines autodetection doesn't work.