Skip to content

vimPlugins: Remove the nvim-cmp dependency on cmp-sources#358809

Merged
khaneliman merged 1 commit intoNixOS:masterfrom
traxys:cmp-dep
Nov 26, 2024
Merged

vimPlugins: Remove the nvim-cmp dependency on cmp-sources#358809
khaneliman merged 1 commit intoNixOS:masterfrom
traxys:cmp-dep

Conversation

@traxys
Copy link
Contributor

@traxys traxys commented Nov 24, 2024

The blink.cmp neovim plugin provides a shim to use sources initially developped for nvim-cmp by using the blink.compat plugin.

This plugin implements a cmp lua module, so that nvim-cmp sources register with blink.cmp instead of registering with nvim-cmp.

If we have a hard dependency on nvim-cmp for cmp sources this means we can't use them with blink.cmp

This also means that we can't easily require the plugin in the check phase, as we would need to add nvim-cmp (or blink.compat) to provide the 'cmp' lua module.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: vim Advanced text editor label Nov 24, 2024
@khaneliman
Copy link
Contributor

Looks like it just needs formatting @traxys

@traxys
Copy link
Contributor Author

traxys commented Nov 24, 2024

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 358809


x86_64-linux

✅ 39 packages built:
  • vimPlugins.cmp-ai
  • vimPlugins.cmp-async-path
  • vimPlugins.cmp-beancount
  • vimPlugins.cmp-clippy
  • vimPlugins.cmp-cmdline
  • vimPlugins.cmp-conjure
  • vimPlugins.cmp-copilot
  • vimPlugins.cmp-ctags
  • vimPlugins.cmp-dap
  • vimPlugins.cmp-dictionary
  • vimPlugins.cmp-digraphs
  • vimPlugins.cmp-fish
  • vimPlugins.cmp-fuzzy-buffer
  • vimPlugins.cmp-fuzzy-path
  • vimPlugins.cmp-git
  • vimPlugins.cmp-greek
  • vimPlugins.cmp-look
  • vimPlugins.cmp-neosnippet
  • vimPlugins.cmp-nixpkgs-maintainers
  • vimPlugins.cmp-npm
  • vimPlugins.cmp-nvim-lsp-signature-help
  • vimPlugins.cmp-nvim-lua
  • vimPlugins.cmp-nvim-tags
  • vimPlugins.cmp-nvim-ultisnips
  • vimPlugins.cmp-pandoc-nvim
  • vimPlugins.cmp-pandoc-references
  • vimPlugins.cmp-path
  • vimPlugins.cmp-rg
  • vimPlugins.cmp-snippy
  • vimPlugins.cmp-tabby
  • vimPlugins.cmp-tabnine
  • vimPlugins.cmp-tmux
  • vimPlugins.cmp-vim-lsp
  • vimPlugins.cmp-vimwiki-tags
  • vimPlugins.cmp-vsnip
  • vimPlugins.cmp-zsh
  • vimPlugins.cmp_luasnip
  • vimPlugins.codeium-nvim
  • vimPluginsUpdater

The `blink.cmp` neovim plugin provides a shim to use sources initially
developped for `nvim-cmp` by using the `blink.compat` plugin.

This plugin implements a `cmp` lua module, so that `nvim-cmp` sources
register with `blink.cmp` instead of registering with `nvim-cmp`.

If we have a hard dependency on nvim-cmp for cmp sources this means we
can't use them with `blink.cmp`

This also means that we can't easily require the plugin in the check
phase, as we would need to add nvim-cmp (or blink.compat) to provide the
'cmp' lua module.
Copy link
Member

@PerchunPak PerchunPak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone uses cmp plugin, I would assume they have already installed and configured cmp itself. Though, we should prevent adding nvim-cmp to dependencies somehow for the future.

@traxys
Copy link
Contributor Author

traxys commented Nov 24, 2024

Though, we should prevent adding nvim-cmp to dependencies somehow for the future.

Not sure how to do that :/

@khaneliman
Copy link
Contributor

If someone uses cmp plugin, I would assume they have already installed and configured cmp itself. Though, we should prevent adding nvim-cmp to dependencies somehow for the future.

I wouldn't worry about it here. I can add them as notes in #352277 when I flag them to not be checked because it will fail the automatic check.

@PerchunPak
Copy link
Member

PerchunPak commented Nov 24, 2024

Also, it would create problems for #352277. Maybe count this as edge-case, for which you have to use an overlay? It feels counter-intuitive to remove cmp from dependencies for plugins that were initially created for cmp, because of some another plugin that also implements cmp module.

The overlay would be something like this:

final: prev:
{
  vimPlugins = prev.vimPlugins // {
    nvim-cmp = final.vimPlugins.blink-compat;
  };
}

@khaneliman
Copy link
Contributor

Also, it would create problems for #352277. Maybe count this as edge-case, for which you have to use an overlay? It feels counter-intuitive to remove cmp from dependencies for plugins that were initially created for cmp, because of some another plugin that also implements cmp module.

The overlay would be something like this:

final: prev:
{
  vimPlugins = prev.vimPlugins // {
    nvim-cmp = final.vimPlugins.blink-cmp;
  };
}

It would just be a note about why we have to ignore it, I already thought about it for another plugin that has a requirement for nvim-web-devicons but mini.icons can be used instead.

@traxys
Copy link
Contributor Author

traxys commented Nov 24, 2024

Also, it would create problems for #352277. Maybe count this as edge-case, for which you have to use an overlay? It feels counter-intuitive to remove cmp from dependencies for plugins that were initially created for cmp, because of some another plugin that also implements cmp module.

The overlay would be something like this:

final: prev:
{
  vimPlugins = prev.vimPlugins // {
    nvim-cmp = final.vimPlugins.blink-compat;
  };
}

That could be an OK workaround

@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Nov 25, 2024
@khaneliman
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 358809


x86_64-linux

✅ 39 packages built:
  • vimPlugins.cmp-ai
  • vimPlugins.cmp-async-path
  • vimPlugins.cmp-beancount
  • vimPlugins.cmp-clippy
  • vimPlugins.cmp-cmdline
  • vimPlugins.cmp-conjure
  • vimPlugins.cmp-copilot
  • vimPlugins.cmp-ctags
  • vimPlugins.cmp-dap
  • vimPlugins.cmp-dictionary
  • vimPlugins.cmp-digraphs
  • vimPlugins.cmp-fish
  • vimPlugins.cmp-fuzzy-buffer
  • vimPlugins.cmp-fuzzy-path
  • vimPlugins.cmp-git
  • vimPlugins.cmp-greek
  • vimPlugins.cmp-look
  • vimPlugins.cmp-neosnippet
  • vimPlugins.cmp-nixpkgs-maintainers
  • vimPlugins.cmp-npm
  • vimPlugins.cmp-nvim-lsp-signature-help
  • vimPlugins.cmp-nvim-lua
  • vimPlugins.cmp-nvim-tags
  • vimPlugins.cmp-nvim-ultisnips
  • vimPlugins.cmp-pandoc-nvim
  • vimPlugins.cmp-pandoc-references
  • vimPlugins.cmp-path
  • vimPlugins.cmp-rg
  • vimPlugins.cmp-snippy
  • vimPlugins.cmp-tabby
  • vimPlugins.cmp-tabnine
  • vimPlugins.cmp-tmux
  • vimPlugins.cmp-vim-lsp
  • vimPlugins.cmp-vimwiki-tags
  • vimPlugins.cmp-vsnip
  • vimPlugins.cmp-zsh
  • vimPlugins.cmp_luasnip
  • vimPlugins.codeium-nvim
  • vimPluginsUpdater

aarch64-linux

✅ 38 packages built:
  • vimPlugins.cmp-ai
  • vimPlugins.cmp-async-path
  • vimPlugins.cmp-beancount
  • vimPlugins.cmp-clippy
  • vimPlugins.cmp-cmdline
  • vimPlugins.cmp-conjure
  • vimPlugins.cmp-copilot
  • vimPlugins.cmp-ctags
  • vimPlugins.cmp-dap
  • vimPlugins.cmp-dictionary
  • vimPlugins.cmp-digraphs
  • vimPlugins.cmp-fish
  • vimPlugins.cmp-fuzzy-buffer
  • vimPlugins.cmp-fuzzy-path
  • vimPlugins.cmp-git
  • vimPlugins.cmp-greek
  • vimPlugins.cmp-look
  • vimPlugins.cmp-neosnippet
  • vimPlugins.cmp-nixpkgs-maintainers
  • vimPlugins.cmp-npm
  • vimPlugins.cmp-nvim-lsp-signature-help
  • vimPlugins.cmp-nvim-lua
  • vimPlugins.cmp-nvim-tags
  • vimPlugins.cmp-nvim-ultisnips
  • vimPlugins.cmp-pandoc-nvim
  • vimPlugins.cmp-pandoc-references
  • vimPlugins.cmp-path
  • vimPlugins.cmp-rg
  • vimPlugins.cmp-snippy
  • vimPlugins.cmp-tabby
  • vimPlugins.cmp-tmux
  • vimPlugins.cmp-vim-lsp
  • vimPlugins.cmp-vimwiki-tags
  • vimPlugins.cmp-vsnip
  • vimPlugins.cmp-zsh
  • vimPlugins.cmp_luasnip
  • vimPlugins.codeium-nvim
  • vimPluginsUpdater

x86_64-darwin

✅ 39 packages built:
  • vimPlugins.cmp-ai
  • vimPlugins.cmp-async-path
  • vimPlugins.cmp-beancount
  • vimPlugins.cmp-clippy
  • vimPlugins.cmp-cmdline
  • vimPlugins.cmp-conjure
  • vimPlugins.cmp-copilot
  • vimPlugins.cmp-ctags
  • vimPlugins.cmp-dap
  • vimPlugins.cmp-dictionary
  • vimPlugins.cmp-digraphs
  • vimPlugins.cmp-fish
  • vimPlugins.cmp-fuzzy-buffer
  • vimPlugins.cmp-fuzzy-path
  • vimPlugins.cmp-git
  • vimPlugins.cmp-greek
  • vimPlugins.cmp-look
  • vimPlugins.cmp-neosnippet
  • vimPlugins.cmp-nixpkgs-maintainers
  • vimPlugins.cmp-npm
  • vimPlugins.cmp-nvim-lsp-signature-help
  • vimPlugins.cmp-nvim-lua
  • vimPlugins.cmp-nvim-tags
  • vimPlugins.cmp-nvim-ultisnips
  • vimPlugins.cmp-pandoc-nvim
  • vimPlugins.cmp-pandoc-references
  • vimPlugins.cmp-path
  • vimPlugins.cmp-rg
  • vimPlugins.cmp-snippy
  • vimPlugins.cmp-tabby
  • vimPlugins.cmp-tabnine
  • vimPlugins.cmp-tmux
  • vimPlugins.cmp-vim-lsp
  • vimPlugins.cmp-vimwiki-tags
  • vimPlugins.cmp-vsnip
  • vimPlugins.cmp-zsh
  • vimPlugins.cmp_luasnip
  • vimPlugins.codeium-nvim
  • vimPluginsUpdater

aarch64-darwin

✅ 39 packages built:
  • vimPlugins.cmp-ai
  • vimPlugins.cmp-async-path
  • vimPlugins.cmp-beancount
  • vimPlugins.cmp-clippy
  • vimPlugins.cmp-cmdline
  • vimPlugins.cmp-conjure
  • vimPlugins.cmp-copilot
  • vimPlugins.cmp-ctags
  • vimPlugins.cmp-dap
  • vimPlugins.cmp-dictionary
  • vimPlugins.cmp-digraphs
  • vimPlugins.cmp-fish
  • vimPlugins.cmp-fuzzy-buffer
  • vimPlugins.cmp-fuzzy-path
  • vimPlugins.cmp-git
  • vimPlugins.cmp-greek
  • vimPlugins.cmp-look
  • vimPlugins.cmp-neosnippet
  • vimPlugins.cmp-nixpkgs-maintainers
  • vimPlugins.cmp-npm
  • vimPlugins.cmp-nvim-lsp-signature-help
  • vimPlugins.cmp-nvim-lua
  • vimPlugins.cmp-nvim-tags
  • vimPlugins.cmp-nvim-ultisnips
  • vimPlugins.cmp-pandoc-nvim
  • vimPlugins.cmp-pandoc-references
  • vimPlugins.cmp-path
  • vimPlugins.cmp-rg
  • vimPlugins.cmp-snippy
  • vimPlugins.cmp-tabby
  • vimPlugins.cmp-tabnine
  • vimPlugins.cmp-tmux
  • vimPlugins.cmp-vim-lsp
  • vimPlugins.cmp-vimwiki-tags
  • vimPlugins.cmp-vsnip
  • vimPlugins.cmp-zsh
  • vimPlugins.cmp_luasnip
  • vimPlugins.codeium-nvim
  • vimPluginsUpdater

@khaneliman
Copy link
Contributor

Going to merge so we can handle testing these differently outside of build checks. Should probably just create test cases where we provide nvim-cmp and blink-compat to verify they work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: vim Advanced text editor 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants