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 end
local function reset_lualine() local function reset_lualine()
if package.loaded['lualine.utils.notices'] then
modules.utils_notices.clear_notices() modules.utils_notices.clear_notices()
end
setup_augroup() setup_augroup()
setup_theme() setup_theme()
modules.loader.load_all(config) modules.loader.load_all(config)
set_statusline() set_statusline()
set_tabline() set_tabline()
if package.loaded['lualine.utils.notices'] then
modules.utils_notices.notice_message_startup() modules.utils_notices.notice_message_startup()
end
new_config = nil new_config = nil
end end

View File

@ -3,7 +3,9 @@
local lualine_require = require'lualine_require' local lualine_require = require'lualine_require'
local require = lualine_require.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 is_valid_filename = lualine_require.is_valid_filename
local sep = package.config:sub(1,1) 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 elseif component.type == 'vimf' or component.type == 'luae' then
return component_types['_'](component) return component_types['_'](component)
else else
notice.add_notice(string.format([[ modules.notice.add_notice(string.format([[
### component.type ### component.type
component type '%s' isn't recognised. Check if spelling is correct.]], 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 end
table.insert(loaded_extensions, local_extension) table.insert(loaded_extensions, local_extension)
else else
notice.add_notice(string.format([[ modules.notice.add_notice(string.format([[
### Extensions ### Extensions
Extension named `%s` was not found . Check if spelling is correct. Extension named `%s` was not found . Check if spelling is correct.
]], extension)) ]], extension))