Skip to content

🐞 Bug: Crashing with nvim v0.12.1 #488

@ujjwal6792

Description

@ujjwal6792

🤖 Which branch are you using?

  • dev
  • main

📜 Issue description:

markview.nvim appears to crash on Neovim 0.12.1 when a markdown buffer is auto-attached during BufEnter/session restore. The failure happens inside Neovim’s Tree-sitter injection/highlight path while markview calls its parser/render attach flow, ending with vim/treesitter.lua:196: attempt to call method 'range' (a nil value).
Observed stack points into markview/parser.lua and markview/actions.lua after markview/autocmds.lua attaches to a markdown buffer. In my setup this is reproducible when opening a markdown file. Disabling markview markdown auto-attach avoids the crash.

📑 Reproduction steps:

  1. Use Neovim 0.12.1 with OXY2DEV/markview.nvim enabled and open a markdown buffer.
  2. Let markview auto-attach on BufEnter/VimEnter.
  3. Observe Neovim throwing a Tree-sitter error: vim/treesitter.lua:196: attempt to call method 'range' (a nil value).
  4. The stack then includes markview/autocmds.lua, markview/actions.lua, and markview/parser.lua.

💻 Minimal init:

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
    spec = {
        {
            "nvim-treesitter/nvim-treesitter",
            build = ":TSUpdate",

            ensure_installed = { "html", "latex", "markdown", "markdown_inline", "typst", "yaml" }
        },
        {
            "OXY2DEV/markview.nvim",
            -- branch = "dev",
            lazy = false
        }
    },
});

📜 Logs:

Error in VimEnter Autocommands for "":
auto-session ERROR: Error restoring session, disabling auto
save.
Error: vim/_core/editor.lua:0: VimEnter Autocommands for
"
"..script nvim_exec2() called at VimEnter Autocommands for
"":0[1]../Users/ace/.local/share/nvim/sessions/
%2FUsers%2Face%2Fwork%2Fmonorepo%2Fdpg-backend.vim[16]..BufEnter
Autocommands for "
": Vim(append):Lua callback: .../
neovim/0.12.1/share/nvim/runtime/lua/vim/treesitter.lua:196:
attempt to call method 'range' (a nil value)
stack traceback:
.../neovim/0.12.1/share/nvim/runtime/lua/vim/
treesitter.lua:196: in function 'get_range'
.../neovim/0.12.1/share/nvim/runtime/lua/vim/
treesitter.lua:231: in function 'get_node_text'
...nvim-treesitter/lua/nvim-treesitter/
query_predicates.lua:141: in function 'handler'
...m/0.12.1/share/nvim/runtime/lua/vim/treesitter/
query.lua:868: in function '_apply_directives'
...m/0.12.1/share/nvim/runtime/lua/vim/treesitter/
query.lua:1089: in function '(for generator)'
...1/share/nvim/runtime/lua/vim/treesitter/
languagetree.lua:1123: in function '_get_injections'
...1/share/nvim/runtime/lua/vim/treesitter/
languagetree.lua:690: in function '_parse'
...1/share/nvim/runtime/lua/vim/treesitter/
languagetree.lua:639: in function 'parse'
...al/share/nvim/lazy/markview.nvim/lua/markview/
parser.lua:153: in function 'parse'
...l/share/nvim/lazy/markview.nvim/lua/markview/
actions.lua:174: in function 'render'
...l/share/nvim/lazy/markview.nvim/lua/markview/
actions.lua:542: in function 'attach'
.../share/nvim/lazy/markview.nvim/lua/markview/
autocmds.lua:255: in function <.../share/nvim/lazy/
markview.nvim/lua/markview/autocmds.lua:194>
[C]: in function 'nvim_exec2'
vim/_core/editor.lua: in function <vim/_core/
editor.lua:0>
[C]: in function 'pcall'
...l/share/nvim/lazy/auto-session/lua/auto-session/
init.lua:847: in function 'restore_session'

And the direct highlighter error:

Decoration provider "start" (ns=nvim.treesitter.highlighter):
Lua: .../neovim/0.12.1/share/nvim/runtime/lua/vim/treesitter/
languagetree.lua:215:
.../neovim/0.12.1/share/nvim/runtime/lua/vim/treesitter.lua:196:
attempt to call method 'range' (a nil value)
stack traceback:
[C]: in function 'f'
.../neovim/0.12.1/share/nvim/runtime/lua/vim/treesitter/
languagetree.lua:215: in function 'tcall'
.../neovim/0.12.1/share/nvim/runtime/lua/vim/treesitter/
languagetree.lua:596: in function 'parse'
.../neovim/0.12.1/share/nvim/runtime/lua/vim/treesitter/
highlighter.lua:580: in function <.../neovim/0.12.1/share/nvim/
runtime/lua/vim/treesitter/highlighter.lua:557>

Neovim version:

0.12.1

✅ Expected behavior:

Markview should run and highlight

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions