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

Lazy is not so forgiving of duplicate dependencies #113

Closed
airtonix opened this issue Dec 22, 2022 · 6 comments
Closed

Lazy is not so forgiving of duplicate dependencies #113

airtonix opened this issue Dec 22, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@airtonix
Copy link

Describe the bug
related to #53

When i drop in ~/.config/nvim/lua/plugins/ui_icons.lua :

return {
    'nvim-tree/nvim-web-devicons',
    url = 'https://github.com/nvim-tree/nvim-web-devicons',
}

I get this error on startup:

# Config Change Detected. Reloading...

- **added**: `.config/nvim/lua//plugins/ui_icons.lua`
Press ENTER or type command to continue
Merging plugins is not supported for key `1`
{
  new = { "kyazdani42/nvim-web-devicons",
    _ = {
      dep = true
    },
    dir = "/home/zenobius/.local/share/nvim/lazy/nvim-web-devicons",
    lazy = true,
    name = "nvim-web-devicons",
    url = "https://github.com/kyazdani42/nvim-web-devicons.git"
  },
  old = { "nvim-tree/nvim-web-devicons",
    _ = {},
    dir = "/home/zenobius/.local/share/nvim/lazy/nvim-web-devicons",
    name = "nvim-web-devicons",
    url = "https://github.com/nvim-tree/nvim-web-devicons"
  }
Press ENTER or type command to continue

Which version of Neovim are you using?

Terminal only.

> asdf current neovim
neovim          0.8.1           /home/zenobius/.tool-versions

> asdf which nvim
/home/zenobius/.asdf/installs/neovim/0.8.1/bin/nvim

> nvim --version

NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az178-366

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

To Reproduce
Make sure to read https://github.com/folke/lazy.nvim/wiki/Minimal-%60init.lua%60-to-Reproduce-an-Issue

Steps to reproduce the behavior:

  1. use https://github.com/airtonix/lazy-nvim-duplicate-deps-bug as the config
  2. see confusing error throw about not being able to merge things ???

Expected Behavior

be more forgiving about duplicate dependencies:

  • if the resolved version is the same
  • if the reoslved version is not the same, throw helpful error

Screenshots
If applicable, add screenshots to help explain your problem.

repro.lua
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",
        "--single-branch",
        "https://github.com/folke/lazy.nvim.git",
        lazypath,
    })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
    -- do not remove the colorscheme!
    "folke/tokyonight.nvim",
    -- add any other pugins here

    {
        -- File Tree
        "nvim-neo-tree/neo-tree.nvim",
        dependencies = {
            "nvim-lua/plenary.nvim",
            "MunifTanjim/nui.nvim",
            'nvim-tree/nvim-web-devicons',
        },
        keys = {
            { '<C-b>', '<C-O>:Neotree filesystem reveal left toggle<CR>', 'i', desc = 'Neotree' },
            { '<C-b>', ':Neotree filesystem reveal left toggle<CR>', 'n', desc = 'Neotree' },
        },
        config = function()

            require('neo-tree').setup({
                popup_border_style = "rounded",
                enable_git_status = true,
                enable_diagnostics = true,
                default_component_configs = {
                    git_status = {
                        symbols = {
                            -- Change type
                            added     = "+", -- or "✚", but this is redundant info if you use git_status_colors on the name
                            modified  = "m", -- or "", but this is redundant info if you use git_status_colors on the name
                            deleted   = "d", -- this can only be used in the git_status source
                            renamed   = "r", -- this can only be used in the git_status source
                            -- Status type
                            untracked = "u",
                            ignored   = "i",
                            unstaged  = "",
                            staged    = "",
                            conflict  = "",
                        }
                    },
                },
                filesystem = {
                    filtered_items = {
                        hide_dotfiles = true,
                        hide_gitignored = true,
                    }
                }
            })



        end
    },

    {
        -- Statusline
        'nvim-lualine/lualine.nvim',
        dependencies = {
            'nvim-tree/nvim-web-devicons',
        },
        config = function()

            require('lualine').setup({
                options = {
                    icons_enabled = true,
                    theme = 'auto',
                    component_separators = { left = '', right = '' },
                    section_separators = { left = '', right = '' },
                    disabled_filetypes = {
                        statusline = {},
                        winbar = {},
                    },
                    ignore_focus = {},
                    always_divide_middle = true,
                    globalstatus = false,
                    refresh = {
                        statusline = 1000,
                        tabline = 1000,
                        winbar = 1000,
                    }
                },
                sections = {
                    lualine_a = { 'mode' },
                    lualine_b = { 'branch', 'diff', 'diagnostics' },
                    lualine_c = { 'filename' },
                    lualine_x = { 'encoding', 'fileformat', 'filetype' },
                    lualine_y = { 'progress' },
                    lualine_z = { 'location' }
                },
                inactive_sections = {
                    lualine_a = {},
                    lualine_b = {},
                    lualine_c = { 'filename' },
                    lualine_x = { 'location' },
                    lualine_y = {},
                    lualine_z = {}
                },
                tabline = {},
                winbar = {},
                inactive_winbar = {},
                extensions = {}
            })
        end
    },
    {
        -- Tab bar
        'noib3/nvim-cokeline',
        dependencies = {
            'nvim-tree/nvim-web-devicons',
        },
        config = function()
            local get_hex = require('cokeline/utils').get_hex
            local cokeline = require('cokeline')

            cokeline.setup({

                show_if_buffers_are_at_least = 1,

                mappings = {
                    cycle_prev_next = true,
                },

                default_hl = {
                    fg = function(buffer)
                        -- return buffer.is_focused and colors.purple or colors.gray
                    end,
                    bg = "NONE",
                    style = function(buffer)
                        return buffer.is_focused and "bold" or nil
                    end,
                },
                sidebar = {
                    filetype = 'neo-tree',
                    components = {
                        {
                            text = 'Files',
                            -- fg = yellow,
                            bg = get_hex('NvimTreeNormal', 'bg'),
                            style = 'bold',
                        },
                    }
                },
                components = {
                    { text = " " },

                    {
                        text = function(buffer)
                            return buffer.unique_prefix or " "
                        end,
                        style = "italic",
                    },

                    {
                        text = function(buffer)
                            return buffer.filename
                        end,
                        style = function(buffer)
                            return buffer.is_focused and "bold" or nil
                        end,
                    },

                    { text = " " },
                    {
                        text = function(buffer)
                            return buffer.is_modified and "" or " "
                        end,
                        fg = function(buffer)
                            -- return buffer.is_focused and colors.red
                        end,
                    },
                    { text = " " },

                    {
                        text = '',
                        delete_buffer_on_left_click = true,
                    },
                    { text = " " },
                },
            })


        end
    }


}
require("lazy").setup(plugins, {
    root = root .. "/plugins",
})

-- add anything else here
vim.opt.termguicolors = true
-- do not remove the colorscheme!
vim.cmd([[colorscheme tokyonight]])

Log
Please include any related errors from the Noice log file. (open with :Lazy log)

Lazy log

@airtonix airtonix added the bug Something isn't working label Dec 22, 2022
@folke
Copy link
Owner

folke commented Dec 22, 2022

read the error message? You specify a plugin with two different names

@folke folke closed this as completed Dec 22, 2022
@folke
Copy link
Owner

folke commented Dec 22, 2022

"kyazdani42/nvim-web-devicons"
"nvim-tree/nvim-web-devicons"

@airtonix
Copy link
Author

Sorry i'm a vim noob.

this detail isn't obvious to new comers, and this never happened with packer.

@airtonix
Copy link
Author

I would expect that these are two different plugins:

"kyazdani42/nvim-web-devicons"
"nvim-tree/nvim-web-devicons"

@folke
Copy link
Owner

folke commented Dec 22, 2022

the plugin got renamed at some point.

It didnt happen with Packer, because Packer didnt check for this. Lazy does and correctlt shows an error message with the exact reason why this can not be merged

@insorker
Copy link

I got the same problem in "nvim-lualine/lualine.nvim" plugin configuration, and fixed it by changing "kyazdani42/nvim-web-devicons" to "nvim-tree/nvim-web-devicons", since they are the same repository.

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