vscode-edit-csv icon indicating copy to clipboard operation
vscode-edit-csv copied to clipboard

Add ability to pad with spaces or remove space padding

Open kavehv opened this issue 2 years ago • 3 comments

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.

kavehv avatar Mar 29 '22 22:03 kavehv

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 avatar Mar 30 '22 15:03 janisdd

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

janisdd avatar Apr 23 '22 09:04 janisdd

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 avatar Jun 16 '22 20:06 janisdd

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

janisdd avatar Jul 24 '23 11:07 janisdd