rpeshkov / vscode-text-tables

VSCode extension that brings the power of Emacs table editing
MIT License
38 stars 14 forks source link

If row/column data contains a pipe character then Format Under Cursor doesn't work #33

Closed wyldphyre closed 6 years ago

wyldphyre commented 6 years ago

If a cell contains a pipe character then the "Format Under Cursor" command doesn't do anything. It would be nice if it was able to work this out, but maybe it isn't possible.

Here is an example of table that won't format:

header 1 Header 2
Clean Content 0.05
Content with a character 0
rpeshkov commented 6 years ago

Confirm that this is a bug and it occurs only in markdown mode.

Also here one thing should be considered: when some row have more columns than other table, should column be deleted in this row or whole table should have 1 more column? In GFM priority goes to the header row, so if any other row has more columns, they will not be displayed, however this might be not very convenient for table editing.

wyldphyre commented 6 years ago

Personally, I don’t think I’d want a new column created. I ran into this because I wanted to actually have a pipe character in my cell data, but that obviously makes parsing quite difficult, and probably shouldn’t be allowed.

rpeshkov commented 6 years ago

In markdown pipe character is allowed, but you need to escape it with "\". In org, pipe characters aren't allowed.

\ Piped\
\
rpeshkov commented 6 years ago

Hi @wyldphyre,

I've fixed this bug. PR: https://github.com/rpeshkov/vscode-text-tables/pull/35

In this fix I implemented second approach for now. That's the one where "whole table should have 1 more column". I'll raise another issue with lower priority to add an option which will allow to select another algorithm of reformatting.

Once all checks will complete and build will be successful, I'll merge this PR and update extension in marketplace.

wyldphyre commented 6 years ago

Thank you