Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grammar sometimes treats numbered lists as definition lists #14

Open
cpkio opened this issue Sep 22, 2021 · 4 comments
Open

Grammar sometimes treats numbered lists as definition lists #14

cpkio opened this issue Sep 22, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@cpkio
Copy link

cpkio commented Sep 22, 2021

- there are many variations of passages of lorem ipsum available, but the
  majority have suffered alteration in some form, by injected humour, or
  randomised words which don't look even slightly believable.

- there are many variations of passages of lorem ipsum available, but the
  majority have suffered alteration in some form, by injected humour, or
  randomised words which don't look even slightly believable.

- there are many variations of passages of lorem ipsum available, but the
  majority have suffered alteration in some form, by injected humour, or
  randomised words which don't look even slightly believable.

There are many variations of passages of Lorem Ipsum available, but the
majority have suffered alteration in some form, by injected humour, or
randomised words which don't look even slightly believable.

1. There are many variations of passages of Lorem Ipsum available, but the
   majority have suffered alteration in some form, by injected humour, or
   randomised words which don't look even slightly believable.

2. There are many variations of Lorem Ipsum available, but the majority have
   suffered alteration in some form, by injected humour, or randomised words
   which don't look even slightly believable.

3. There are many variations of passages of Lorem Ipsum available, but the
   majority have suffered in some form, by injected humour, or randomised
   words don't look even slightly believable.

Using gwis or gwip on any of these list items will eventually lead to first line of them be recognized as definition list term (mostly because definition list is allowed by grammar to start from a number or a bullet I suppose).

The reference says these lists are correct:

List item bodies must be left-aligned and indented relative to the bullet; the text immediately after the bullet determines the indentation. For example:

- This is the first bullet list item.  The blank line above the
  first list item is required; blank lines between list items
  (such as below this paragraph) are optional.

- This is the first paragraph in the second item in the list.

  This is the second paragraph in the second item in the list.
  The blank line above this paragraph is required.  The left edge
  of this paragraph lines up with the paragraph above, both
  indented relative to the bullet.

  - This is a sublist.  The bullet lines up with the left edge of
    the text blocks above.  A sublist is a new list so requires a
    blank line above and below.

- This is the third item of the main list.

This paragraph is not part of the list.
@stsewd
Copy link
Owner

stsewd commented Sep 25, 2021

Hi, I'm not able to replicate this with your example

Screenshot 2021-09-25 at 17-54-52 reStructuredText grammar for tree-sitter - tree-sitter-rst

the CST is correctly generated. I think you may have some whitespaces that github is removing, would be better if you share it as a file.

@cpkio
Copy link
Author

cpkio commented Sep 26, 2021

TS Playground does not replace Neovim practice.

I've created an isolated environment, with only TS (+rst grammar) and TSPlayground plugins installed. Then I'm opening test file, TSPlayground panel, bind gwip to for speed and you can see unumbered and then numbered lists turning into terms lists on <A-q> press.

2021-09-26_20-44-08

@stsewd
Copy link
Owner

stsewd commented Sep 29, 2021

Hmmm, that's interesting, I wasn't aware of gw, looks like it formats the line to respect the textwidth option. Anyway, don't think this is a problem with the grammar, but a bug on neovim, after saving and reloading the buffer the correct tree is shown.

@stsewd
Copy link
Owner

stsewd commented Dec 29, 2023

This is the same problem as #44.

@stsewd stsewd added the bug Something isn't working label Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants