nvim-neorocks / rocks-dev.nvim

A swiss-army knife for testing and developing rocks.nvim modules.
GNU General Public License v3.0
14 stars 3 forks source link

Contributing Guide? #27

Open benlubas opened 1 month ago

benlubas commented 1 month ago

I'm interested in adding the feature described in #14 but I've no clue how to develop/test locally.

When I'm in the nix shell, I get an error when I launch neovim:

Error detected while processing /home/benlubas/.local/share/nvim/rocks/lib/luarocks/rocks-5.1/rocks.nvim/2.36.0-1/plugin/rocks.lua:
E5113: Error while calling lua chunk: ...s/.local/share/nvim/rocks/rocks_rtp/lua/rocks/loader.lua:22: attempt to call field 'luarocks_config_path' (a nil value)
stack traceback:
        ...s/.local/share/nvim/rocks/rocks_rtp/lua/rocks/loader.lua:22: in function 'enable'
        .../luarocks/rocks-5.1/rocks.nvim/2.36.0-1/plugin/rocks.lua:30: in main chunk
mrcjkb commented 1 month ago

Hey 👋

I'm interested in adding the feature described in #14

Awesome 🚀 ❤️

When I'm in the nix shell, I get an error when I launch neovim

How are you launching neovim? This project has a flake output that you can use with nix run .#neovim-with-rocks. It comes with rocks.nvim and rocks-dev.nvim. It sets NVIM_APPNAME to nvimrocks to make sure it doesn't use your default configs, so the rocks.toml will be in ~/.config/nvimrocks. The init.lua is hardcoded as part of the nix derivation.

One thing to look out for is not to install rocks.nvim modules, because doing so will result in rocks.nvim being installed impurely from luarocks.org.

There's a contributing guide in the rocks.nvim repo. Most of that is also applicable here. I'm afraid the workflow using the nvim-with-rocks derivation for manual testing is poorly documented because I'm the only one who uses it.

Perhaps an ideal approach would be to write an integration test for it. You should be able to run busted within the devShell.

benlubas commented 1 month ago

The error happened when launching normally with just nvim.

Running nix run .#neovim-with-rocks works, it launches and doesn't error. I get a fairly minimal config. When I run :Rocks edit though, I don't see rocks-dev.nvim listed, I only see "rocks.nvim".

I will test out the integration test route when I get a chance, thank you!

mrcjkb commented 1 month ago

When I run :Rocks edit though, I don't see rocks-dev.nvim listed

That's because rocks.nvim initialises the default config without any extensions. I think rocks-dev should still be loaded since the nix derivation is added to neovim's runtimepath.

And you probably don't want it in the rocks.toml because Rocks sync|update might try to install it from luarocks.org. In fact, you might want to remove the rocks.nvim entry, too.

I'm still working out a good way to set up minimal nix derivations for rocks.nvim extensions 😅. Perhaps in a separate flake with a nix function that lets you choose which rocks.nvim extensions to enable.