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] Avante plugin dependencies are missing #3028

Open
1 task done
erahhal opened this issue Feb 22, 2025 · 9 comments
Open
1 task done

[BUG] Avante plugin dependencies are missing #3028

erahhal opened this issue Feb 22, 2025 · 9 comments
Labels
bug Something isn't working

Comments

@erahhal
Copy link

erahhal commented Feb 22, 2025

Field Description
Plugin avante
Nixpkgs unstable
Home Manager not used
  • I have read the FAQ and my bug is not listed there.

Description

Minimal, Reproducible Example (MRE)

checkhealth shows the following:

avante: require("avante.health").check()

avante.nvim ~
- ERROR Missing required plugin: MunifTanjim/nui.nvim
- ERROR Missing required plugin: nvim-lua/plenary.nvim
- OK Found required plugin: nvim-treesitter/nvim-treesitter
- ERROR Missing required plugin: stevearc/dressing.nvim
- OK Found icons plugin (nvim-web-devicons or mini.icons)

But all these plugins are installed and detected by other plugins that need them.

See https://git.homefree.host/homefree/nixvim-config/src/branch/main/plugins/avante.nix

programs.nixvim.plugins = {
    ## required dependencies
    dressing.enable = true;  # this is archived and may break in the future
    nui.enable = true;
    # Treesitter enabled elsewhere

    ## optional dependencies
    cmp.enable = true;
    copilot-lua.enable = true;
    fzf-lua.enable = true;
    mini.enable = true;
    telescope.enable = true;
    web-devicons.enable = true;

    avante = {
      enable = true;

      settings = {
        provider = "copilot";

        files = {
          auto_include = true;  # Automatically include relevant files
          max_files = 50;       # Maximum number of files to include in context
          max_size_kb = 1000;   # Maximum total size of files in KB

          # Define which files to include/exclude
          include = [
            "*.lua"
            "*.nix"
            "*.rs"
            "*.ts"
            "*.js"
            "*.jsx"
            "*.tsx"
            # Add more patterns as needed
          ];

          exclude = [
            "node_modules/**"
            "dist/**"
            ".git/**"
            # Add more patterns to exclude
          ];
        };
      };
    };
  };
};
@erahhal erahhal added the bug Something isn't working label Feb 22, 2025
@erahhal
Copy link
Author

erahhal commented Feb 22, 2025

I noticed that other plugins that don't have problems finding these dependencies don't show the full plugin name in checkhealth, e.g. plenary.nvim vs nvim-lua/plenary.nvim. Not sure if this makes a difference

@khaneliman
Copy link
Contributor

Basically, it seems like any vimPlugins migrated to using buildNeovimPlugin are not working properly with dependencies. Many plugins were recently migrated NixOS/nixpkgs#376370

@erahhal
Copy link
Author

erahhal commented Feb 22, 2025

Thanks for the details. I couldn't figure out the difference between vimPlugins and buildNeovimPlugin based on a cursory review of that PR. Is this something that is expected to big fixed soon, or is a solution not yet known? Is there an issue ticket tracking this? thank you!

@erahhal
Copy link
Author

erahhal commented Feb 22, 2025

Looking at the generated init.lua even if I have nui.enable=true there is no reference to nui anywhere. I tried adding require('nui') and require('nui-nvim') and both throw errors.

@MattSturgeon
Copy link
Member

Do you have inputs.nixvim.inputs.nixpkgs.follows in your flake.nix?

Removing that and running nix flake lock should allow nixvim to use the nixpkgs revision specified in our lockfile. This is the latest nixpkgs revision that has pass our CI test suite.

@MattSturgeon MattSturgeon changed the title [BUG] <BUG> Avante plugin dependencies not seen [BUG] Avante plugin dependencies are missing Feb 23, 2025
@erahhal
Copy link
Author

erahhal commented Feb 23, 2025

You are right, I did have the follows setting, but I removed it and am still seeing the same issue with missing plugins in checkhealth. Are you saying that the CI test suite runs checkhealth or otherwise verifies that the plugins are pulling in their proper dependencies?

@MattSturgeon
Copy link
Member

Our test suite only checks that nvim runs without printing anything to stdout/stderr. This catches most issues.

It would be nice if we had a test that parses :checkhealth to detect issues, but idk how simple that'd be.

It sounds like in this specific case our tests didn't catch the issue, so you may have to specify an even older nixpkgs revision for nixvim to use 😔

@erahhal
Copy link
Author

erahhal commented Feb 25, 2025

I realized that Avante is actually successfully using the plugins. It's just the checkhealth call that is failing. Not sure if this is an issue with Avante or Nixvim, but I opened a ticket with Avante to change how they check for plugins. They are using a path mechanism that doesn't seem to work with Nixvim.

@MattSturgeon
Copy link
Member

MattSturgeon commented Feb 25, 2025

Their implementation is Utils.has: https://github.com/yetone/avante.nvim/blob/984fe877bfee4cf26e1e5f7e13cc284b6f26bc10/lua/avante/utils/init.lua#L24-L31

Seems like it checks for a lazy.nvim config and the falls back to checking a package.loaded table. Not sure where package comes from, maybe its a nvim global?

Nixvim uses the same wrapNeovimUnstable as home-manager, which is listed as a supported installation method in their README.

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

3 participants