marksman
marksman copied to clipboard
Table Formatting
Formatting tables manually is a pain. Does table formatting sound like a plausible feature? I can use a third party formatter in the meantime but it does sound convenient.
@n0s4 yes, as a code action it makes a lot of sense!
I hope marksman does not become a tool for formatting, we have prettier for that. If that is too slow then there is Deno written in rust that is very fast.
If it does become a formatter then please make sure there is as an option to turn it off. Cheers :)
To set clear expectations, I do see value in this functionality but unless someone comes, implements this code action and sends a PR (which I'd be happy to accept), I wouldn't count on Marksman becoming a full blown formatter any time soon. My personal todo list is currently quite full with improvements to the core functionality.
More than just format, I think having a way of autocompleting a table would be super useful. For example, a Create a Table code action that you can press <tab> to to go the next column, and then <return> to go to the next row. As it stands creating MD tables is a huge pain, since you don't know how long each column is. Obviously a formatter would also help if you have to modify the table, but being able to create them correctly right away would be really great UX.
@jfaz1 I agree it'd be convenient! In terms of UX, org-mode tables come to mind first. But I do wonder what it would look like in terms of LSP interaction. The protocol doesn't allow much dynamism, so I don't really know how a code action (or anything else) would support the use-case of dynamic table creation/manipulation. I can see a set of code-actions a-la Create Table, Add Row, Add Column but this wouldn't be quite as fluent as hitting <tab> and <ret>.
Disagree with some comments. LSP supports and should handle formatting. It would be great if marksman can format the markdown for you the same as other LSP does on-save (such as gopls, terraform-ls, etc). If it does not yet do so already (I ended up here seeing if it can rather than to complain that it can't).
Just wanna add that updating the ToC is something that I can see being part of the formatting rather than a code action.