nvim-neorocks / rocks.nvim

Neovim plugin management inspired by Cargo, powered by luarocks
GNU General Public License v3.0
553 stars 7 forks source link

[Feature] Support version constraints (`~>`, `>=`, etc) #404

Open mrcjkb opened 1 week ago

mrcjkb commented 1 week ago

Discussed in https://github.com/nvim-neorocks/rocks.nvim/discussions/403

Originally posted by **rktjmp** June 22, 2024 Does rocks.nvim support semver constraints? I assumed it would be delegated to luarocks, which does [appear to support constraints (under dependencies)](https://github.com/luarocks/luarocks/wiki/Rockspec-format#dependency-information) but `norg = "~> 7"` (and variations) fails with a "version number '~> 7' could not be parsed" error during a `Rocks sync`. Is it a planned feature?

Blocked by https://github.com/luarocks/luarocks/issues/1684

mrcjkb commented 1 week ago

Some potential downsides:

We could also add a separate (not to be edited) installed_version field for any rock where the version is a constraint. This would solve both problems, but could lead to undefined behaviour if users modify it.

rktjmp commented 1 week ago

To add some complexity to the request, a Rocks outdated feature is useful with this, so you can see when your constraint is potentially outdated, eg the "latest" column below:

image

mrcjkb commented 1 week ago

To add some complexity to the request, a Rocks outdated feature is useful with this, so you can see when your constraint is potentially outdated, eg the "latest" column below:

image

I've been thinking of writing a small language server for rocks.toml that provides diagnostics and code actions.

vhyrro commented 1 week ago

I don't even think a language server is needed, just some smart adaptors to the vim.lsp protocol, unless that's what you meant. I do agree that an LSP interface for rocks.toml would be incredible for general UX.

mrcjkb commented 1 day ago

With https://github.com/nvim-neorocks/rocks.nvim/pull/459, you will by default be prompted if an update will have a breaking change. I'm not sure if there's really a strong use case for specifying things like ~> 1.5 or ~> 1,5.5.

Given #459 combined with the ability to pin rocks, is there even a need for this at all?