vscode_rainbow_csv icon indicating copy to clipboard operation
vscode_rainbow_csv copied to clipboard

"Align CSV Columns" shifts number with 4 spaces to the right

Open prechy123 opened this issue 2 years ago • 4 comments

After using Align CSV Columns numbers are shifted to the right with 4 spaces, affecting when it is called in code.

prechy123 avatar Nov 18 '23 21:11 prechy123

Could you please clarify what do you mean by "affecting when it is called in code"? I also need an example of the current and expected behavior. There is a special rule for numbers alignment (see #106), unlike non-number fields they are aligned to the right so that it is easier to compare the values.

mechatroner avatar Nov 19 '23 01:11 mechatroner

Without Align CSV Columns

image

With Align CSV columns

image

It can easily be fixed by using strip(), but i think the extension should be able to take care of it, it cost me several minutes of debugging

prechy123 avatar Nov 27 '23 22:11 prechy123

I guess I can add a config option that would tell if the numbers should be aligned to the right (default) or to the left like all other non-number fields.

mechatroner avatar Nov 28 '23 01:11 mechatroner

I am also encountering this issue with this data:

date      	 transaction_type	 amount                  	 from           	 to            	 description	 chain_id	 url
2022-10-06	 CREDIT          	   117.603346555789962218	 Safe Foundation	 ETH Public Pot	 Airdrop    	        1	 https://etherscan.io/tx/0x2f7c591bfa254ef71f7ce4def1792d3230487565f117027c069dd290fea0954d
2022-10-06	 CREDIT          	 66850.7876              	 Safe Foundation	 ETH Public Pot	 Airdrop    	        1	 https://etherscan.io/tx/0x2f7c591bfa254ef71f7ce4def1792d3230487565f117027c069dd290fea0954d

There are two extra spaces before the 117 amount:

Image

I noticed that if I make the amount on the 3rd row a 3-digit number (i.e. turn 66850.7876 into 668.7876), the 2nd row gets properly formatted:

Image

PaulRBerg avatar Sep 12 '25 19:09 PaulRBerg