tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
411 stars 52 forks source link

Neovim crashes when editing multilevel list #114

Closed fisher-j closed 11 months ago

fisher-j commented 1 year ago

Describe the bug

When editing a multilevel list, and starting a new "de-dented" list item neovim crashes without warning. Often this only happens after typing and deleting a character (with backspace) on the new item.

For instance, if I open a test.md with the following contents:

# A list

- item 1
  - sub-item
    - level three
  -

and then place my cursor on the last line, and type a space followed by some characters, and then possibly a backspace, neovim crashes.

The behavior is reproducible, but not perfectly so. To reproduce I might have to do any of the following (on the last line, after the list marker):

I was able to reproduce this behavior when treesitter is the only plugin I load.

Once I was able to reopen the file and observe an error which I think mentioned an out of range index for extmark, but unfortunately, I have not be able to reproduce the error message.

difeiyu commented 1 year ago

I also encountered this problem, the same way to reproduce

## HOME
- a
    - aa
        - aaa
    - ac

vim crashes when backspace is pressed I removed all plugins except treesitter, same goes for tests

ibash commented 1 year ago

Maybe related: https://github.com/neovim/neovim/issues/25164

ibash commented 1 year ago

For posterity, you can apply the patch as per instructions here: https://github.com/neovim/neovim/issues/25164#issuecomment-1722150924

zmre commented 1 year ago

This bug has been killing me. Stack traces were misleading. Random quits when editing notes. Have temporarily disabled treesitter markdown but am hoping the linked PR gets accepted and a new release made. I see the workaround that uses ibash's fork, and I can make that work if necessary (though differently since I use nix), but would far rather see it fixed here. I know maintaining open source software like this can be thankless, so just want to send out a thank you to whomever (@MDeiml ?) is able to review and help get the bug fix through to a release. Thank you and thanks to @ibash for tracking it down!