janisdd / vscode-edit-csv

vs code extension to edit csv files with an excel like table ui
MIT License
211 stars 30 forks source link

Handling of field that contains multiple lines #116

Closed case-inlite closed 1 year ago

case-inlite commented 1 year ago

Description

The CSV editor does not properly handle fields that contain multiple lines. This results in the editor either not recognizing the file as a valid CSV and not displaying an "Edit CSV" button, or rendering a blank screen when the button is pressed. =

Expected behavior

The CSV editor should recognize a field wrapped with double quotes that contains multiple lines as a single field in a row and render it correctly. Additionally, the enclosing double quotes should be preserved when saving the file.

Steps to reproduce

  1. Create a CSV file with the following content:
    Name,Age,Address
    Alice,30,"123 Main St,
    New York, NY"
    Bob,25,"456 Elm St,
    Los Angeles, CA"
  2. Open the CSV file in the CSV editor.
  3. Observe the following possible behaviors: a. The editor does not recognize the file as a valid CSV. b. The "Edit CSV" button is not displayed. c. The "Edit CSV" button is displayed, but a blank screen appears when the button is pressed.
janisdd commented 1 year ago

Can't reproduce this. I opened a new file, pasted your example switched language (bottom right) to CSV and clicked the Edit csv button -> works.

What language is displayed in the bottom right status bar?

Or maybe you have some other csv related extensions isntalled? Rainbow csv works fine with this extension, not sure about others.

case-inlite commented 1 year ago

Disabling Rainbow CSV solved my problem, thanks for pointing me in the right direction. Apologies for taking up your time!

janisdd commented 1 year ago

@case-inlite Well, that is interesting. Normally the extensions play well together... Do you have the latest version of edit csv plugin (0.7.4)? Last update I fixed an issue that showed similar behavior when Rainbow CSV was used. Rainbow CSV changed the language (bottom right) to dynamic CSV.

case-inlite commented 1 year ago

@janisdd I reenabled Rainbow Edit and while it plays nice with some CSVs, others trigger Dynamic CSV. I have been unable to figure out why.

When I try and change the format to CSV it doesn't seem to stick, but changing it to CSV (Semicolon) does. Can't share current CSVs as the data is sensitive.

CSV0.7.4 and Rainbow v3.6.0.

janisdd commented 1 year ago

@case-inlite I think this is now fixed in version 0.7.5. The "command" was working but the button was just not displayed.

case-inlite commented 1 year ago

@janisdd thanks seems to be working reliably now