sswatson / table-editor-vscode

9 stars 0 forks source link

Can you add tsv support? #2

Closed TryTryAgain closed 1 year ago

TryTryAgain commented 1 year ago

Would it be as simple as adding it to export type TableEditorFormat = 'csv' | 'tsv' | 'md' | 'html' | 'json' | 'unknown';?

sswatson commented 1 year ago

I tried it just now, and it seems that openCSV works to open TSV as well.

TSV is often considered a special case of CSV, with the idea that it's basically the same thing but with a different delimiter. Apparently the CSV parser this package uses handles that part automatically.

That said, it would be nice to have TSV output, and you can't do that with the current version of the extension. That's going into the new version (0.3.7) shipping this afternoon.

TryTryAgain commented 1 year ago

Ah, that's great on the output side. But are you saying TSV works for csv files, I honestly didn't even try renaming. That is a workaround, could 'tsv' extension also not be supported so if the source files are .tsv files instead of .csv tab-separated files it would still work? That's what didn't work for me. I will definitely rename to csv as a workaround and think the TSV output is a welcomed addition, thanks!

sswatson commented 1 year ago

This extension takes a different approach from other extensions vis-a-vis whole-file vs. partial-file table access, with the idea being that you might have several tables in the same file (for example, in a Markdown file). Namely, you select the plain text representing your table in your editor and then invoke an appropriate command to open that table in the extension.

From this point of view, file extensions don't matter, meaning that you can keep your .tsv extensions. Just open your TSV file and invoke the open-table command. Even the auto-detection seems to work for this.

Let me know if I'm missing something, though.

sswatson commented 1 year ago

I'm going to close this issue because I think TSVs have first-class support at this point.