TatsuyaNakamori / vscode-reStructuredText

Language Support for reStructuredText
MIT License
3 stars 2 forks source link

Table indentation with sphinx #2

Open mfrailis opened 2 years ago

mfrailis commented 2 years ago

First of all, thanks a lot for this extension, which is very useful. For tables, sphinx permits some directives, such as ".. table::" to specify a number of options (https://docutils.sourceforge.io/docs/ref/rst/directives.html#table). These directives require the entire table to be indented. Such indentation is not considered in your code and hence the TAB or reformat functionalities are ignored. In particular:

Cheers, Marco

TatsuyaNakamori commented 2 years ago

Thank you for your feedback.

I've checked the problem. Certainly, it needs to be fixed.

Due to my busy work schedule, I may not be able to address it right away, but I will make it a priority.

I will provide a status report in this thread.

mfrailis commented 2 years ago

Just to let you know, I think I solved the issue in my fork of your project: https://github.com/mfrailis/vscode-reStructuredText where I created an indent attribute or parameter in a couple of your methods (reformat and _generateTableString). So, by shifting the first line of a table (the one starting with "+-----"), the overall table will be indented as the first line, using the TAB key

Other changes only concern syntax recommendations highlighted by VSCode.

TatsuyaNakamori commented 2 years ago

Thank you so much. I have created a branch and created a new pull request.

I will preview the code and make sure it works, and if everything is ok, it will be officially merged.

TatsuyaNakamori commented 2 years ago

I have merged it into the "feature/0.1.3" branch. I would like to review it in the "feature/0.1.3" branch to make sure it works. Please wait a moment while the check is completed.

TatsuyaNakamori commented 2 years ago

I have reviewed your code.

Does the code you modified correspond to a table pattern like the one at the top, in the figure below?

Or is it the "GridTable" extension that this extension has traditionally supported?

GridTable" recognizes indentation in some parts, but there are still flaws, such as indentation being removed when the Enter button is pressed.

At this time we are unable to release it yet.

pic_031

TatsuyaNakamori commented 2 years ago

Thank you for shedding light on the indentation pattern. I will continue to develop it, but I am inevitably busy with my day job...

However, I am moving forward little by little, so please wait for me!

mfrailis commented 2 years ago

Thank you again for the review.

Concerning the type of tables supported, I just extended your current code, which handles Grid Tables only. They are fully supported by both plain restructured text syntax and also by Sphinx (without additional extensions):

https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#tables

Supporting "Simple tables" requires some more design changes to your code. At last, restructured text (and Sphinx) also support table cells spanning multiple rows or columns, which are more complex to design.

About the flaw when using the return key, you are right, I should have checked it.

No problem with waiting.

Best.

sachin-suresh-rapyuta commented 9 months ago

@TatsuyaNakamori - Thanks much for the extension first of all. I'm checking to see if this has made some progress.

I would also like to:

  1. Tab the existing grid table
  2. Flexibility to use ..table directive along with table name.
TatsuyaNakamori commented 9 months ago

I appreciate your request. We will work on the debugging as we go along, so please wait a little longer. We apologize for the delay.