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

codeblock adjacent to list item is not recognized #118

Open
echasnovski opened this issue Jan 23, 2024 · 2 comments
Open

codeblock adjacent to list item is not recognized #118

echasnovski opened this issue Jan 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@echasnovski
Copy link
Member

Example:

- Line starts with dash:
>
 This is not recognized as code block
<

This seems to be a known problem, but there is no issue to track it and for users to consult with.

I tried to fix this, but the assumption that code block is not contiguous to list item seems to be too much entangled in the grammar itself. So looks like it would at least require serious refactor if at all possible.

The current workaround is to have a blank link after list item text block (contiguous lines without blank lines with first starting with list prefix). So this will work:

- Line starts with dash:

>
 This is recognized as code block
<
@justinmk justinmk added the bug Something isn't working label Jan 23, 2024
@justinmk
Copy link
Member

justinmk commented Jan 23, 2024

Looks like Vim's help syntax "supports" this (but it has no concept of list-items, which is a major feature of tree-sitter-vimdoc).

The general idea in tree-sitter-vimdoc is that "blocks" are separated by a blank line. In the given example, the > immediately follows the list-item thus it would be part of the list-item (if this bug didn't exist), not a separate block. But it looks like you expect it to be a separate block?

Note that this does work (in both Vim-syntax and tree-sitter-vimdoc):

- Line starts with dash: >
  code line1
  code line2
<

@echasnovski
Copy link
Member Author

But it looks like you expect it to be a separate block?

I would expect that codeblock formatting would take precedence over list items, yes. Mostly because it is supported in Vim's help and in Markdown.

Note that this does work (in both Vim-syntax and tree-sitter-vimdoc):

Yes, this is a better solution as it allows to add only single blank line at the top of code block (similar to the one in the initial comment). I thought I tried it before and it did not work. Apparently, missed something.

This feels like a decent workaround, though. Now the original example only looks like inconsistency and not like a big issue.

@justinmk justinmk changed the title Code block is not recognized inside list item codeblock adjacent to list item is not recognized Jan 23, 2024
echasnovski added a commit to echasnovski/mini.cursorword that referenced this issue Jan 29, 2024
echasnovski added a commit to echasnovski/mini.indentscope that referenced this issue Jan 29, 2024
echasnovski added a commit to echasnovski/mini.surround that referenced this issue Jan 29, 2024
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