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: Plugin nvim not found #1566

Closed
3 tasks done
hahuang65 opened this issue Jun 26, 2024 · 7 comments · Fixed by #1565
Closed
3 tasks done

bug: Plugin nvim not found #1566

hahuang65 opened this issue Jun 26, 2024 · 7 comments · Fixed by #1565
Labels
bug Something isn't working

Comments

@hahuang65
Copy link

hahuang65 commented Jun 26, 2024

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have searched the existing issues of lazy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.11.0-dev-313+gfc9b70826-Homebrew Build type: Release LuaJIT 2.1.1716656478

Operating system/version

macOS 14.3 (23D56)

Describe the bug

When I load a file into a buffer, I get a notification

2024-06-26T14:52:04 lazy.nvim  ERROR Plugin nvim not found

Steps To Reproduce

I open nvim and :e somefile.

Expected Behavior

No error.
I wonder if it's a specific plugin that's having the error upon load. Is there a debug mode so I can see what Lazy is doing?

@hahuang65 hahuang65 added the bug Something isn't working label Jun 26, 2024
@max397574
Copy link
Contributor

likely because it's a dependency from a rockspec which gets parsed since 11.0
could you make sure you updated lazy and provide a minimal reproducible config?

@folke
Copy link
Owner

folke commented Jun 26, 2024

Can you also post the output of :checkhealth lazy?
And make sure you don't have literally "nvim" somewhere in your specs

@hahuang65
Copy link
Author

hahuang65 commented Jun 26, 2024

Okay, it looks like the issue is folke/todo-comments.nvim. I have a file in lua/plugins/todo-comments.lua with the contents:

-- https://github.com/folke/todo-comments.nvim

return {
  "folke/todo-comments.nvim",
  event = { "BufReadPre", "BufNewFile" },
  dependencies = {
    "nvim-lua/plenary.nvim",
    "catppuccin/nvim",
  },
  keys = {
    {
      "]t",
      function()
        require("todo-comments").jump_next()
      end,
      desc = "Next todo comment",
    },
    {
      "[t",
      function()
        require("todo-comments").jump_prev()
      end,
      desc = "Previous todo comment",
    },
    { "<leader>st", ":TodoTelescope<CR>", desc = "[S]earch [T]ODOs" },
  },
  config = function()
    local C = require("catppuccin.palettes").get_palette()

    require("todo-comments").setup({
      signs = false,
      colors = {
        error = { "DiagnosticError", "ErrorMsg", C.red },
        warning = { "DiagnosticWarn", "WarningMsg", C.yellow },
        info = { "DiagnosticInfo", C.sapphire },
        hint = { "DiagnosticHint", C.green },
        default = { "Identifier", C.peach },
        test = { "Identifier", C.lavender },
      },
    })
  end,
}

If I simply remove this file from that directory such that Lazy doesn't load it... I don't have the error.

Strangely, when I try to put it in repro.lua:

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  -- add any other plugins here
  "nvim-lua/plenary.nvim",
  "catppuccin/nvim",
  "folke/todo-comments.nvim",
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

local C = require("catppuccin.palettes").get_palette()

require("todo-comments").setup({
  signs = false,
  colors = {
    error = { "DiagnosticError", "ErrorMsg", C.red },
    warning = { "DiagnosticWarn", "WarningMsg", C.yellow },
    info = { "DiagnosticInfo", C.sapphire },
    hint = { "DiagnosticHint", C.green },
    default = { "Identifier", C.peach },
    test = { "Identifier", C.lavender },
  },
})

vim.cmd.colorscheme("tokyonight")

I'm not able to reproduce the issue.

To answer your questions, I'm not familiar with luarocks or rockspec, and I'm certainly not intentionally using any luarocks.

I'm also not using any custom specs.

Finally, checkhealth lazy:

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

lazy.nvim ~
- OK {git} `version 2.45.2`
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found

luarocks ~
- checking `luarocks` installation
- OK no plugins require `luarocks`, so you can ignore any warnings below
- OK {luarocks} `/Users/hhhuang/.local/share/mise/installs/lua/5.1/luarocks/bin/luarocks 3.11.1`
- OK {lua} `Lua 5.1  Copyright (C) 1994-2006 Lua.org, PUC-Rio`

@max397574
Copy link
Contributor

@folke issue perhaps because of catpuccin/nvim and nvim is ignored because of neovim dependency in rockspecs?
so having just nvim as repository name won't work?

@hahuang65
Copy link
Author

Possible, but I also have lua/plugins/catppuccin.lua whose contents are:

return {
  "catppuccin/nvim",
  name = "catppuccin",
  config = function()
    local catppuccin = require("catppuccin")
    vim.g.catppuccin_flavour = require("common").catppuccin_palette

    catppuccin.setup({
      compile = {
        enabled = true,
        path = vim.fn.stdpath("cache") .. "/catppuccin",
      },
      dim_inactive = {
        enabled = true,
        shade = "dark",
        percentage = 0.10,
      },
      transparent_background = false,
      term_colors = true,
      styles = {
        comments = { "italic" },
        functions = { "bold" },
        keywords = { "underline" },
        strings = {},
        variables = {},
      },
      integrations = {
        cmp = true,
        dap = {
          enabled = true,
          enable_ui = true,
        },
        fidget = true,
        gitsigns = true,
        indent_blankline = {
          enabled = true,
          colored_indent_levels = false,
        },
        mason = true,
        neotest = true,
        native_lsp = {
          enabled = true,
          virtual_text = {
            errors = { "bold", "italic" },
            hints = { "underline" },
            warnings = { "italic" },
            information = { "italic" },
          },
          underlines = {
            errors = { "underline" },
            hints = { "underline" },
            warnings = { "underline" },
            information = { "underline" },
          },
        },
        notify = true,
        octo = true,
        treesitter = true,
        treesitter_context = true,
        telescope = true,
      },
    })

    vim.cmd([[colorscheme catppuccin]])
    vim.api.nvim_set_hl(0, "CursorColumn", { link = "CursorLine" })
  end,
}

and this doesn't seem to cause any issues.

@hahuang65
Copy link
Author

@folke issue perhaps because of catpuccin/nvim and nvim is ignored because of neovim dependency in rockspecs? so having just nvim as repository name won't work?

Actually, this seems to be correct, but only in this case. My lua/plugins/catppuccin.lua file doesn't cause issues, but removing it as a dependency in lua/plugins/todo-comments.lua resolves the issue.

I wonder if it's specific to dependencies key.

@folke
Copy link
Owner

folke commented Jun 26, 2024

There's probably a bug in there indeed. Will look into it.

As for your dependencies, you don't need those. Lua deps are resolved automatically, so just remove them.

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

Successfully merging a pull request may close this issue.

3 participants