config overwritten on user/project modules save

When a user modifies and saves the init.lua or a project module file the
reload_customizations() function was performing unnecessary reloading
of core.config and core.style. This resulted on the replacement of config
tables with new tables, breaking all active references been used by
the consumers of this config options. Been redundant this means
that every consumer was using its own copy of a configuration table
different from the one referenced on core.config and user changes not
taking place.
This commit is contained in:
jgmdev 2022-03-09 02:15:01 -04:00
parent 960b482061
commit eeb2b28a03
1 changed files with 10 additions and 26 deletions

View File

@ -65,24 +65,8 @@ end
local function reload_customizations()
-- The logic is:
-- - the core.style and config modules are reloaded with the purpose of applying
-- the new user's and project's module configs
-- - inside the core.config the existing fields in config.plugins are preserved
-- because they are reserved to plugins configuration and plugins are already
-- loaded.
-- - plugins are not reloaded or unloaded
local plugins_save = {}
for k, v in pairs(config.plugins) do
plugins_save[k] = v
end
core.reload_module("core.style")
core.reload_module("core.config")
core.load_user_directory()
core.load_project_module()
for k, v in pairs(plugins_save) do
config.plugins[k] = v
end
end