enhance:Don't load notice module when there are no notices

This commit is contained in:
shadmansaleh 2021-08-30 18:22:02 +06:00
parent 1afc45294a
commit b0da16addd
2 changed files with 11 additions and 5 deletions

View File

@ -246,13 +246,17 @@ local function setup_augroup()
end
local function reset_lualine()
modules.utils_notices.clear_notices()
if package.loaded['lualine.utils.notices'] then
modules.utils_notices.clear_notices()
end
setup_augroup()
setup_theme()
modules.loader.load_all(config)
set_statusline()
set_tabline()
modules.utils_notices.notice_message_startup()
if package.loaded['lualine.utils.notices'] then
modules.utils_notices.notice_message_startup()
end
new_config = nil
end

View File

@ -3,7 +3,9 @@
local lualine_require = require'lualine_require'
local require = lualine_require.require
local notice = require'lualine.utils.notices'
local modules = lualine_require.lazy_require{
notice = 'lualine.utils.notices',
}
local is_valid_filename = lualine_require.is_valid_filename
local sep = package.config:sub(1,1)
@ -49,7 +51,7 @@ local function component_loader(component)
elseif component.type == 'vimf' or component.type == 'luae' then
return component_types['_'](component)
else
notice.add_notice(string.format([[
modules.notice.add_notice(string.format([[
### component.type
component type '%s' isn't recognised. Check if spelling is correct.]], component.type))
@ -105,7 +107,7 @@ local function load_extensions(config)
end
table.insert(loaded_extensions, local_extension)
else
notice.add_notice(string.format([[
modules.notice.add_notice(string.format([[
### Extensions
Extension named `%s` was not found . Check if spelling is correct.
]], extension))