nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.03k stars 134 forks source link

Org src block error on save #425

Open d-r-jenkins opened 2 years ago

d-r-jenkins commented 2 years ago

Describe the bug

If you label a src_block as being in the org language, there is a long pause upon saving, and then an error message appears, but the save is successful.

The traceback is normally:

Error executing vim.schedule lua callback: vim/shared.lua:0: stack overflow
stack traceback:
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'startswith'
        ...-linux64/share/nvim/runtime/lua/vim/treesitter/query.lua:94: in function 'get_query_files'
        ...-linux64/share/nvim/runtime/lua/vim/treesitter/query.lua:183: in function 'get_query'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:52: in function 'new'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:230: in function 'add_child'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:161: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...4/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:166: in function 'parse'
        ...te/pack/packer/start/orgmode/lua/orgmode/parser/file.lua:158: in function 'from_content'
        ...te/pack/packer/start/orgmode/lua/orgmode/parser/file.lua:145: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

But sometimes just appears as:

Error detected while processing BufWritePost Autocommands for "*.org":
Error executing lua callback: error in error handling

It appears to get stuck in an infinite loop having an org block inside org. Maybe this is better to take up with a treesitter dev, but thought it best to start here!

Steps to reproduce

Have an org file of the form

#+begin_src org
 Hello
#+end_src

And try to save it

Expected behavior

It would just save as normal

Emacs functionality

n/a

Minimal init.lua

local org = require('orgmode')
org.setup_ts_grammar()
org.setup({
    org_agenda_files = {'~/Documents/org/gtd/*'},
    org_default_notes_file = '~/Documents/org/gtd/inbox.org',
})

Screenshots and recordings

No response

OS / Distro

Linux Mint

Neovim version/commit

0.8, but was present in 0.7

Additional context

No response

jgollenz commented 1 year ago

@Daniel-Jenkins thanks for reporting :+1: This happens for me as well