Skip to content

Commit

Permalink
feat(meta): check for dir changes for plugins already added to the rtp
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 24, 2024
1 parent 05e31ad commit ee2ca39
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lua/lazy/core/meta.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ function M:add(plugin)

table.insert(meta._.frags, fragment.id)

if meta._ and meta._.rtp_loaded then
local old_dir = meta.dir
self:_rebuild(meta.name)
local new_dir = meta.dir
if old_dir ~= new_dir then
local msg = "Plugin `" .. meta.name .. "` changed `dir`:\n- from: `" .. old_dir .. "`\n- to: `" .. new_dir .. "`"
msg = msg .. "\n\nThis plugin was already partially loaded, so things may break.\nPlease fix your config."
self.spec:error(msg)
end
end

if plugin.name then
-- handle renames
if meta.name ~= plugin.name then
Expand Down

0 comments on commit ee2ca39

Please sign in to comment.