neorg icon indicating copy to clipboard operation
neorg copied to clipboard

Rocks install neorg: setup() errors on nvim-treesitter.ts_utils

Open willcoxe opened this issue 10 months ago • 3 comments

Prerequisites

  • [X] I am using the latest stable release of Neovim
  • [X] I am using the latest version of the plugin

Neovim Version

NVIM v0.10.0-dev-2698+g00e71d3da3

Neorg setup

require("neorg").setup()

Actual behavior

Neorg not loading at all. Error message:

Error detected while processing /home/myuser/.local/share/nvim/rocks/lib/luarocks/rocks-5.1/rocks.nvim/2.19.1-1/plugin/rocks.lua:
E5113: Error while calling lua chunk: ...cal/share/nvim/rocks/rocks_rtp/lua/rocks-config/init.lua:41: ...ua/neorg/modules/core/integrations/treesitter/module.lua:53: Unable to load nvim-treesitter.ts_utils :(
stack traceback:
        [C]: in function 'error'
        ...cal/share/nvim/rocks/rocks_rtp/lua/rocks-config/init.lua:41: in function 'setup'
        ...rocks/rocks_rtp/lua/rocks-config/rocks/hooks/preload.lua:20: in function 'hook'
        ...local/share/nvim/rocks/rocks_rtp/lua/rocks/api/hooks.lua:63: in function 'run_preload_hooks'
        .../luarocks/rocks-5.1/rocks.nvim/2.19.1-1/plugin/rocks.lua:31: in main chunk

Expected behavior

No error & being able to start using :Neorg

Steps to reproduce

  1. install nvim
  2. follow instructions for setting up rocks from https://github.com/nvim-neorocks/rocks.nvim (e.g. run: nvim -u NORC -c "source https://raw.githubusercontent.com/nvim-neorocks/rocks.nvim/master/installer.lua")
  3. exec Rocks install rocks-config.nvim
  4. exec Rocks install neorg
  5. echo "require("neorg").setup()" >> .config/nvim/lua/plugins/neorg.lua

Potentially conflicting plugins

No other plugins, installed everything fresh, followed instructions

Other information

Also tried with other versions of nvim (installed via archlinux > nvim, nvim-git and/or nvim-nightly)

Help

None

Implementation help

No response

willcoxe avatar Mar 26 '24 08:03 willcoxe

Hey, one of the rocks.nvim developers here :)

Currently the nvim-treesitter plugin in Luarocks has some problems that I will describe below, so if you don't want to read all that, I will tell you the direct solution before the explanation :p

It will be best if you use rocks-git.nvim (which is a rocks.nvim extension to also install plugins through Git) to install nvim-treesitter currently.


But why?

nvim-treesitter versioning is not semantic, and is really strange, which makes it unreliable.

The original nvim-treesitter package (neovim/nvim-treesitter) follows this version, which is not bad, but it has some trade-offs. off:

  • In the latest version available there is a bug with the parser installation directory since luarocks does not follow the directory hierarchy that nvim-treesitter normally expects to have.
  • Since plugin releases are not updated very frequently, some parsers can break because the tree-sitter queries are handled directly by nvim-treesitter, so they can become obsolete if there is a change that breaks in some parser (e.g. the javascript parser is completely broken when you enter a .js file)

Now, if that version works, why the errors? This is because the nvim-neorocks team behind rocks.nvim maintains a repository of user rocks (NURR) which has priority on the hosts that use rocks.nvim to get rocks and the version of nvim-treesitter that is in that repository is the main branch (needs Neovim nightly!), in which the nvim-treesitter team is constantly rewriting the plugin and removing things that already exist in the vim.treesitter API, and one of those things is used by neorg, which which causes neorg to break due to its absence :(

NTBBloodbath avatar Mar 27 '24 00:03 NTBBloodbath

Perfect. Thanks for the extensive explanation that was really helpful.

I now have installed treesitter via rocks-git.nvim & it is included in the rocks.toml like:

[plugins.nvim-treesitter]
git = "nvim-treesitter/nvim-treesitter"
rev = "v0.9.2^{}"

and it works now!

Small notes just for interest

  1. running :Neorg sync-parsers echos some nvim-treesitter things but nothing breaks as a result (apparently)
  2. I use :TSInstall for all the parsers now rather than rocks & this doesn't seem to create any issues at all

willcoxe avatar Mar 27 '24 09:03 willcoxe

Same error, i have rocks-tresitter

CRAG666 avatar Apr 13 '24 05:04 CRAG666

I've since added information in the README how to temporarily overcome the issues related to nvim-treesitter :)

I plan on dropping nvim-treesitter as a dependency of Neorg, but until that happens the workarounds present there will be required!

vhyrro avatar Jun 11 '24 17:06 vhyrro