Opened 6 months ago

Closed 5 months ago

#70072 closed defect (fixed)

neovim @0.10.0: missing tree-sitter parsers

Reported by: thestr4ng3r (Florian Märkl) Owned by: raimue (Rainer Müller)
Priority: Normal Milestone:
Component: ports Version: 2.9.3
Keywords: haspatch Cc: l2dy (Zero King), judaew (Vadym-Valdis Yudaiev)
Port: neovim

Description

As of 0.10.0, neovim assumes a couple of bundled tree-sitter parsers to be installed in the prefix under /lib/nvim/parser:

$ ls (...)/lib/nvim/parser/
bash.so			lua.so			markdown_inline.so	query.so		vimdoc.so
c.so			markdown.so		python.so		vim.so

This is currently not the case with the port and thus neovim reports errors like these when opening e.g. :help:

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: /opt/local/share/nvim/runtime/filetype.lua:35: Error executing lua: /opt/local/share/nvim/runtime/filetype.lua:36: BufReadPost A
utocommands for "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20]..script /opt/local/share/nvim/runtime/ftplugin/help.lua: Vim(runtime):E51
13: Error while calling lua chunk: ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:107: no parser for 'vimdoc' language, see :help treesitter-pars
ers
stack traceback:
        [C]: in function 'error'
        ...local/share/nvim/runtime/lua/vim/treesitter/language.lua:107: in function 'add'
        ...l/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:111: in function 'new'
        /opt/local/share/nvim/runtime/lua/vim/treesitter.lua:41: in function '_create_parser'
        /opt/local/share/nvim/runtime/lua/vim/treesitter.lua:108: in function 'get_parser'
        /opt/local/share/nvim/runtime/lua/vim/treesitter.lua:416: in function 'start'
        /opt/local/share/nvim/runtime/ftplugin/help.lua:2: in main chunk
        [C]: in function 'nvim_cmd'
        /opt/local/share/nvim/runtime/filetype.lua:36: in function </opt/local/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'nvim_buf_call'
        /opt/local/share/nvim/runtime/filetype.lua:35: in function </opt/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_cmd'
        /opt/local/share/nvim/runtime/filetype.lua:36: in function </opt/local/share/nvim/runtime/filetype.lua:35>
        [C]: in function 'nvim_buf_call'
        /opt/local/share/nvim/runtime/filetype.lua:35: in function </opt/local/share/nvim/runtime/filetype.lua:10>
stack traceback:
        [C]: in function 'nvim_buf_call'
        /opt/local/share/nvim/runtime/filetype.lua:35: in function </opt/local/share/nvim/runtime/filetype.lua:10>

Upstream instructions about the parsers is here: https://github.com/neovim/neovim/blob/master/BUILD.md#how-to-build-without-bundled-dependencies

If treesitter parsers are not bundled, they need to be available in a parser/ runtime directory (e.g. /usr/share/nvim/runtime/parser/).

As suggested there, the parsers can be built and made to be installed during the actual neovim build by running something like the following before the configure phase, in order to only bundle the tree-sitter parsers but no other dependencies:

cmake -S cmake.deps -B .deps -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -DUSE_BUNDLED=OFF -DUSE_BUNDLED_TS_PARSERS=ON
cmake --build .deps
# now build neovim itself

Change History (3)

comment:1 Changed 6 months ago by thestr4ng3r (Florian Märkl)

Sent a pr with the pre-configure step above: https://github.com/macports/macports-ports/pull/24120

comment:2 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: l2dy judaew added
Keywords: haspatch added
Owner: set to raimue
Status: newassigned
Summary: neovim 0.10.0: missing tree-sitter parsersneovim @0.10.0: missing tree-sitter parsers

comment:3 Changed 5 months ago by thestr4ng3r (Florian Märkl)

Resolution: fixed
Status: assignedclosed

In 77f8d99816f5e9ac3ef7869a772f79f1d26f8f24/macports-ports (master):

neovim: Build and install tree-sitter parsers (https://github.com/macports/macports-ports/pull/24120)

neovim needs a number of prebuilt parsers in <prefix>/lib/nvim/parser/
or else it will throw errors when opening e.g. ":help".
USE_BUNDLED is also not a valid option for the root cmake build system
anymore, but applies to the one in cmake.deps/.

Closes: #70072

Note: See TracTickets for help on using tickets.