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

[BUG] Module blink-cmp not found #3001

Open
1 task done
darkylein opened this issue Feb 10, 2025 · 1 comment
Open
1 task done

[BUG] Module blink-cmp not found #3001

darkylein opened this issue Feb 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@darkylein
Copy link

darkylein commented Feb 10, 2025

Field Description
Plugin blink-cmp
Nixpkgs github:NixOS/nixpkgs/1da52dd49a127ad74486b135898da2cef8c62665?narHash=sha256-KRwX9Z1XavpgeSDVM/THdFd6uH8rNm/6R%2B7kIbGa%2B2s%3D
Home Manager github:nix-community/home-manager/433799271274c9f2ab520a49527ebfe2992dcfbd?narHash=sha256-fmhq8B3MvQLawLbMO%2BLWLcdC2ftLMmwSk%2BP29icJ3tE%3D
  • I have read the FAQ and my bug is not listed there.

Description

When blink-cmp and lsp are enabled, blink-cmp.get_lsp_capabilities is called in init.lua, which throws module 'blink-cmp' not found on neovim startup, when lazy-loading is enabled for blink-cmp.

Error detected while processing /nix/store/jq910xxwp6bq03mnlhrmd0qvnnk2ma8x-init.lua:
E5113: Error while calling lua chunk: /nix/store/jq910xxwp6bq03mnlhrmd0qvnnk2ma8x-init.lua:28: module 'blink-cmp' not found:
        no field package.preload['blink-cmp']
        no file '/nix/store/px57hpxqb37yq7jg83lf4b9j3q6mbsc6-luajit-2.1.1713773202/share/lua/5.1/blink-cmp.lua'
        no file '/nix/store/ris0s0bgfkn24d0hklyhxml78fdsz12g-luajit-2.1.1713773202-env/share/lua/5.1/blink-cmp.lua'
        no file '/nix/store/ris0s0bgfkn24d0hklyhxml78fdsz12g-luajit-2.1.1713773202-env/share/lua/5.1/blink-cmp/init.lua'
        no file '/nix/store/ris0s0bgfkn24d0hklyhxml78fdsz12g-luajit-2.1.1713773202-env/lib/lua/5.1/blink-cmp.so'
stack traceback:
        [C]: in function 'require'
        /nix/store/jq910xxwp6bq03mnlhrmd0qvnnk2ma8x-init.lua:28: in function '__lspCapabilities'
        /nix/store/jq910xxwp6bq03mnlhrmd0qvnnk2ma8x-init.lua:35: in main chunk
Press ENTER or type command to continue

The corresponding line was added in f2f70b4 and looks like this:

capabilities = require("blink-cmp").get_lsp_capabilities(capabilities)

When lazy-loading is disabled it works fine. So I assume is not loaded because of the lazy-loading conditions.
Is it possible to safely call blink-cmp.get_lsp_capabilities when the plugin is lazy-loaded, or should I adjust my configuration to load the plugin earlier i.e. disabling lazy-loading?

Minimal, Reproducible Example (MRE)

{
  plugins = {
    blink-cmp = {
      enable = true;

      lazyLoad.settings.event = ["InsertEnter" "CmdlineEnter"];
    };

    lsp.enable = true;

    lz-n.enable = true;
  };
}
@darkylein darkylein added the bug Something isn't working label Feb 10, 2025
@khaneliman
Copy link
Contributor

As mentioned in #2982 (comment), lazy loading support isn't guaranteed to work OOTB. It's still experimental and has too many conditions.

If you want to workaround that particular error, you can just disable the setting up of lsp capabilities via the module

setupLspCapabilities = false;

You could probably use lz.n's trigger_load to set that up later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants