wbthomason/packer.nvim

Behaviour of requires seems slightly unintuitive

Open

#87 opened on 2020年11月15日

GitHub で見る
 (23 comments) (0 reactions) (0 assignees)Lua (264 forks)batch import
enhancementhelp wantedoverdue_for_fix

Repository metrics

Stars
 (8,097 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

When plugin A requires plugin B, I expect Plugin B to be available before Plugin A starts loading. Packer adds Plugin B to "after" of A i.e. plugin B is loaded after plugin A is loaded, which is slightly unintuitive in terms of what I would expect from a dependency. This causes issues when the dependency of an optional plugin is not available in "start" packages. Reproduction:

vim.cmd [[packadd packer.nvim]]

local packer = require("packer")

packer.startup(
    function(use)
        -- Packer can manage itself as an optional plugin
        use {"wbthomason/packer.nvim", opt = true}
        use {
            "nvim-lua/telescope.nvim",
            requires = {{"nvim-lua/popup.nvim", opt = true}, {"nvim-lua/plenary.nvim", opt = true}},
            cmd = {"Telescope"},
        }
    end
)

Calling "Telescope find_files" results in the following error.

Error detected while processing function <SNR>8_load:
line    1:
E5108: Error executing lua [string ":lua"]:111: Vim(let):E5108: Error executing lua ...ite/pack/packer/opt/telescope.nvim/lua/telescope/log.lua:2: module 'plenary.log' not found:
        no field package.preload['plenary.log']
        no file './plenary/log.lua'
        no file '/usr/share/luajit-2.0.5/plenary/log.lua'
        no file '/usr/local/share/lua/5.1/plenary/log.lua'
        no file '/usr/local/share/lua/5.1/plenary/log/init.lua'
        no file '/usr/share/lua/5.1/plenary/log.lua'
        no file '/usr/share/lua/5.1/plenary/log/init.lua'
        no file './plenary/log.so'
        no file '/usr/local/lib/lua/5.1/plenary/log.so'
        no file '/usr/lib/lua/5.1/plenary/log.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file './plenary.so'
        no file '/usr/local/lib/lua/5.1/plenary.so'
        no file '/usr/lib/lua/5.1/plenary.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'

コントリビューターガイド