janisdd / vscode-edit-csv

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

Add ability to pad with spaces or remove space padding #86

Closed kavehv closed 1 year ago

kavehv commented 2 years ago

I like to leave my CSV tables padded with spaces so they align with a fixed-width font for easy viewing. I'm wondering if it would be easy to add this option to this extension to ignore spaces next to delimiters when reading and re-pad the cells with spaces when writing such that the commas remain aligned.

janisdd commented 2 years ago

I’m not sure if this is in the scope of this extension… There are others, e.g. https://marketplace.visualstudio.com/items?itemName=phplasma.csv-to-table or https://marketplace.visualstudio.com/items?itemName=mechatroner.rainbow-csv which might be more suitable for that. Adding additional spaces would also bloat the file, increasing file size…

That being said, adding spaces to the right while writing the file should be easy. (What should happen to multi line cells is not clear to me.) When opening the table, all cells would need to remove the trailing spaces (how do you know if the space is intended or just for alignment?).

So, I don’t think this is a good idea, what is your opinion?

janisdd commented 2 years ago

This might not help much but #89 allows to use fixed-width font in the table

janisdd commented 2 years ago

I just found out today that https://marketplace.visualstudio.com/items?itemName=mechatroner.rainbow-csv can format csv files to align columns. Open the command palette and search for align csv columns

Ignoring spaces before and after separators could be useful... I might consider it in the future

janisdd commented 1 year ago

As rainbow csv extension already provides this feature, I consider this out of scope.