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

Trigger name-based autodetection with upper-case `.CSV` extension along with the standard `.csv` #141

Closed scheichreisuli closed 1 year ago

scheichreisuli commented 1 year ago

Hello,

I'm on Windows 10, POWERSHELL 7.x and VSCode 1.80.2

I did export some CSV-files by POWERSHELL using the export-csv command and the ConvertTo-CSV-feature of POWERSHELL. The delimiter is pipe ( "|" ), strings are only quoted when needed. For me the CSV-files seem to be valid, I can read them and convert them to JSON or WINDOWS-PSCustomObject, Therefore I think there is no major problem with the files.

I changed the POWERSHELL-script to modify the CSV-structure (header-names, new columns).

The latest CSV-files I created are no more colored by the Rainbow-extension. It seems, the files are 'seen' as a one or two column-file. It seems the delimiters are not respected correctly.

Maybe there is something wrong with the CSV-files even if I did not have any problems with them.

I attache two short CSV-files:

'rainbow-csv_colorized.csv' works fine in VSCode (including table-view), 'rainbow-csv_not colorized.csv' does not.

If the CSV-files have any issues I apologise for this issue. As mentioned before I have no problems to work with both sample CSV-files in POWERSHELL.

Keep healthy

rainbow-csv_colorized.csv rainbow-csv_not colorized.CSV

mechatroner commented 1 year ago

Thank you for the bug report! I did a few tests and I am almost certain that this happens because of 2 reasons:

  1. The file is too small that the standard content-based autodetection logic doesn't trigger.
  2. There is also fallback logic which forces autodetection triggering if the filetype is .csv no matter how many lines it has, but the file in your example has '.CSV' extension instead of '.csv' (changing it to .csv fixes the problem). So I will probably add another check for .CSV in upper case too when I have more time.
scheichreisuli commented 1 year ago

Thanx for the quick answering.

I confirm changing the file-extension to lower-case fixes the issue.

Have a nice day

mechatroner commented 1 year ago

Done in 3.8.0