Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rocks.nvim install: #946

Open
teto opened this issue Mar 26, 2025 · 5 comments
Open

rocks.nvim install: #946

teto opened this issue Mar 26, 2025 · 5 comments

Comments

@teto
Copy link

teto commented Mar 26, 2025

I had treesitter errors for orgmode (installed via nix) but I noticed that orgmode had both its plugin and the grammar on luarocks.org so I thought I would install it via Rocks instead.

I take notes here before adding rocks command to https://github.com/nvim-orgmode/orgmode/blob/master/docs/installation.org

I've got those 2 installed in :Rocks edit

tree-sitter-orgmode = "2.0.0"
orgmode = "0.5.2"

Apparently I would not need to use tree-sitter-orgmode since it's already a dependency:
https://luarocks.org/manifests/kristijanhusak/orgmode-0.5.2-1.rockspec

checkhealth rocks-config complained about

Checking for errors while loading configs ~
- ERROR Error while loading config 'orgmode.lua' for 'orgmode'.
  - ADVICE:
    - Error was: ...rocks/rocks_rtp/lua/orgmode/utils/treesitter/install.lua:18: [orgmode] Failed to copy generated tree-sitter parser to runtime folder: ENOENT: no such file or directory: /home/teto/.cache/nvim/tree-sitter-org/parser.so -> /home/teto/.local/share/nvim/rocks/rocks_rtp/parser/org.so

So in this case orgmode wrongly tries to install tree-sitter-org instead of tree-sitter-orgmode ?

Fixed by adding vim.opt.runtimepath:append(vim.fs.joinpath(vim.fn.stdpath("data"), "rocks", "lib", "luarocks", "rocks-5.1", "tree-sitter-", "")) in init.lua.

I stumbled upon this message #804 (comment) . is it sill valid ?

The advantage of rocks.nvim is that it should install all dependencies including the parser but in this cade I also had orgmode trying to compile the grammar while it should already be available ?

@teto
Copy link
Author

teto commented Mar 26, 2025

I received this warning from orgmode :

Conflicting org parser(s) found in these locations:
- `/home/teto/.local/share/nvim/rocks/lib/luarocks/rocks-5.1/tree-sitter-orgmode/2.0.0-1/parser/org.so`
Remove them to avoid conflicts.

I think it should show all conflicting grammars, how does it know which is the correct one ?
I had to run checkhealth vim.treesitter to find the other one:

- OK Parser: org                  ABI: 14, path: /home/teto/.local/share/nvim/rocks/lib/luarocks/rocks-5.1/tree-sitter-orgmode/2.0.0-1/parser/org.so
- OK Parser: org                  ABI: 14, path: /home/teto/.local/share/nvim/rocks/rocks_rtp/parser/org.so

@kristijanhusak
Copy link
Member

Even though it's against the luarocks convention, I'll probably remove the dependency on the luarocks level and have orgmode install the grammar.
I'm not sure how exactly rocks work, and handling this conflict seems unnecessary.

Regarding that comment, it looks like something that should work out of the box, in terms that you should not be required to add the path to rtp, but again, I'm not aware of the Rocks underlying structure.

Once the new version is up (should be soon), you should not have this issue any more.

@kristijanhusak
Copy link
Member

Ok release is out. I suggest you just remove both installed parsers, update nvim-orgmode to the latest version, and let it install the parser.

@teto
Copy link
Author

teto commented Mar 27, 2025

Even though it's against the luarocks convention, I'll probably remove the dependency on the luarocks level and have orgmode install the grammar.

ha now I am sad because I have been advocating for automatic dependency management since forever. Removing the dependency is a regression.
I used to install the library via the package manager nix as well as I dont want to have a compiler in my env or accessible to neovim.
I think the check might be at fault here: how does it know which one is the correct grammar ? I could have added my own to rtp. Meanwhile it could have been moved to checkhealth orgmode.
Note that on neovim 0.11, checkhealth vim.treesitter helps spot redundant parsers so orgmode's check might be redundant

@kristijanhusak
Copy link
Member

I think the check might be at fault here: how does it know which one is the correct grammar ?

It is expected to be in the parser/ directory of the orgmode installation, where it is being installed by the orgmode.

I'm aware this is somewhat a regression, but TBH I don't think a lot of people adopted the rocks.nvim. I know lazy.nvim also supports luarocks to some extent, but I didn't test if it works with this tree-sitter grammar installation.
This way it's streamlined and there's no need to worry about the conflicts.

Once Neovim hopefully ships a full support for WASM parsers, we will have it prebuilt as part of the repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants