nvim-neorg/tree-sitter-norg

Invalid node type after 8a8710c

yelite opened this issue · 1 comments

I got this error when using the latest code in the main branch.

Error executing vim.schedule lua callback: [string "<nvim>"]:66: ...ed-0.6.0/share/nvim/runtime/lua/vim/treesitter/query.lua:161: query: invalid node type at position 178
stack traceback:
	[C]: in function '(for generator)'
	[string "<nvim>"]:66: in function <[string "<nvim>"]:61>

The problem can be reproduced after 8a8710c (inclusively). The last good commit is bfa7949.

Besides this one, there is another error when executing the BufEnter autocommand, even on bfa7949.

E5108: Error executing lua ...ed-0.6.0/share/nvim/runtime/lua/vim/treesitter/query.lua:161: query: invalid node type at position 18
stack traceback:
	[C]: in function '_ts_parse_query'
	...ed-0.6.0/share/nvim/runtime/lua/vim/treesitter/query.lua:161: in function 'parse_query'
	...lua/neorg/modules/core/norg/esupports/metagen/module.lua:48: in function 'is_metadata_present'
	...lua/neorg/modules/core/norg/esupports/metagen/module.lua:95: in function 'inject_metadata'
	...lua/neorg/modules/core/norg/esupports/metagen/module.lua:123: in function 'on_event'
	...k-dir/pack/home-manager/start/neorg/lua/neorg/events.lua:154: in function <...k-dir/pack/home-manager/start/neorg/lua/neorg/events.lua:136>
	...k-dir/pack/home-manager/start/neorg/lua/neorg/events.lua:158: in function 'broadcast_event'
	...art/neorg/lua/neorg/modules/core/autocommands/module.lua:42: in function '_neorg_module_autocommand_triggered'
	[string ":lua"]:1: in main chunk

Relevant part of my config:

local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()

parser_configs.norg = {
    install_info = {
        url = "https://github.com/nvim-neorg/tree-sitter-norg",
        files = { "src/parser.c", "src/scanner.cc" },
        -- branch = "main",
        revision = "bfa794931ba8eeb62a15c57b0c65e01b63a6f4d3",
    },
}

parser_configs.norg_meta = {
    install_info = {
        url = "https://github.com/nvim-neorg/tree-sitter-norg-meta",
        files = { "src/parser.c" },
        branch = "main",
    },
}

parser_configs.norg_table = {
    install_info = {
        url = "https://github.com/nvim-neorg/tree-sitter-norg-table",
        files = { "src/parser.c" },
        branch = "main",
    },
}

:version

NVIM v0.6.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by nixbld

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/nix/store/qyawd05zszdvcrgbvdhr2q4ay6ac4v9r-neovim-unwrapped-0.6.0/share/nvim"

Run :checkhealth for more info

checkhealth:

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
  - WARNING: `node` executable not found (only needed for :TSInstallFromGrammar, not required for :TSInstall)
  - OK: `git` executable found.
  - OK: `gcc` executable found. Selected from { "gcc", "cc", "gcc", "clang", "cl", "zig" }
    Version: gcc (GCC) 10.3.0
  - OK: Neovim was compiled with tree-sitter runtime ABI version 13 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - jsonc          ✓ ✓ ✓ ✓ ✓ 
  - yaml           ✓ ✓ ✓ ✓ ✓ 
  - nix            ✓ ✓ ✓ . ✓ 
  - bash           ✓ ✓ ✓ . ✓ 
  - rust           ✓ ✓ ✓ ✓ ✓ 
  - lua            ✓ ✓ ✓ ✓ ✓ 
  - html           ✓ ✓ ✓ ✓ ✓ 
  - python         ✓ ✓ ✓ ✓ ✓ 
  - javascript     ✓ ✓ ✓ ✓ ✓ 
  - css            ✓ . ✓ ✓ ✓ 
  - norg_meta      . . . . . 
  - norg_table     . . . . . 
  - json           ✓ ✓ ✓ ✓ . 
  - vim            ✓ ✓ . . ✓ 
  - typescript     ✓ ✓ ✓ ✓ ✓ 
  - tsx            ✓ ✓ ✓ ✓ ✓ 
  - norg           ✓ . ✓ . ✓ 
  - toml           ✓ ✓ ✓ ✓ ✓ 
  - go             ✓ ✓ ✓ ✓ ✓ 
  - fish           ✓ ✓ ✓ ✓ ✓ 

It turned out my neorg is outdated (it's the version as of 2021-12-08 even though it's from the latest unstable nixpkgs). Updating neorg to the latest revision fixes all the problems.