File tree 3 files changed +13
-2
lines changed
3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 495
495
function M .auto_load (modname , modpath )
496
496
local plugin = Plugin .find (modpath )
497
497
if plugin and modpath :find (plugin .dir , 1 , true ) == 1 then
498
+ plugin ._ .rtp_loaded = true
498
499
-- don't load if we're loading specs or if the plugin is already loaded
499
500
if not (Plugin .loading or plugin ._ .loaded ) then
500
501
if plugin .module == false then
Original file line number Diff line number Diff line change @@ -459,10 +459,19 @@ function Spec:merge(old, new)
459
459
end
460
460
461
461
local new_dir = new ._ .dir or old ._ .dir or (new .name and (Config .options .root .. " /" .. new .name )) or nil
462
- if new_dir ~= new .dir then
463
- self :warn (" Plugin `" .. new .name .. " ` changed `dir`:\n - from: `" .. new .dir .. " `\n - to: `" .. new_dir .. " `" )
462
+ if new_dir ~= old .dir then
463
+ local msg = " Plugin `" .. new .name .. " ` changed `dir`:\n - from: `" .. old .dir .. " `\n - to: `" .. new_dir .. " `"
464
+ if new ._ .rtp_loaded or old ._ .rtp_loaded then
465
+ msg = msg
466
+ .. " \n\n This plugin was already partially loaded, so we did not change it's `dir`.\n Please fix your config."
467
+ self :error (msg )
468
+ new_dir = old .dir
469
+ else
470
+ self :warn (msg )
471
+ end
464
472
end
465
473
new .dir = new_dir
474
+ new ._ .rtp_loaded = new ._ .rtp_loaded or old ._ .rtp_loaded
466
475
467
476
new ._ .super = old
468
477
setmetatable (new , { __index = old })
Original file line number Diff line number Diff line change 19
19
--- @field super ? LazyPlugin
20
20
--- @field module ? string
21
21
--- @field dir ? string Explicit dir or dev set for this plugin
22
+ --- @field rtp_loaded ? boolean
22
23
23
24
--- @alias PluginOpts table | fun ( self : LazyPlugin , opts : table ): table ?
24
25
You can’t perform that action at this time.
0 commit comments