From b4316da7310682144c279c5f0451e59ee5f6c9d1 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Sun, 16 Jun 2024 15:52:21 +0200 Subject: [PATCH] fix(plugin): rebuild optional when needed and remove frags from parent deps. Fixes #1402 --- lua/lazy/core/plugin.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/lazy/core/plugin.lua b/lua/lazy/core/plugin.lua index c7716b6..8d18e33 100644 --- a/lua/lazy/core/plugin.lua +++ b/lua/lazy/core/plugin.lua @@ -232,6 +232,15 @@ function Spec:remove_fragments(id, opts) else local plugin = self.plugins[id] repeat + if plugin._.fpid then + local parent = self.fragments[plugin._.fpid] + if parent then + parent._.fdeps = vim.tbl_filter(function(fid) + return fid ~= plugin._.fid + end, parent._.fdeps) + self.dirty[parent.name] = true + end + end fids[#fids + 1] = plugin._.fid plugin = plugin._.super until not plugin @@ -318,11 +327,10 @@ function Spec:fix_disabled() self.disabled[plugin.name] = plugin end end + self:rebuild() -- check optional plugins again self:fix_optional() - - -- rebuild any plugin specs that were modified self:rebuild() end