AstroUI config doesn't include the user config when extending heirline
Checklist
- [X] I have searched through the AstroNvim docs
- [X] I have searched through the existing issues of AstroNvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
0.9.5
Operating system/version
macOS 14.4.1
Terminal/GUI
iTerm
Describe the bug
❗ I need to do some more investigation and narrow down a reproduction, so this issue is preliminary for now.
The issue I'm facing is related to porting my custom tab pages heirline config to V4. I get the following error:
If I print the contents of config from file_icon in astroui/status/hl on line 68, like this:
function M.file_icon(name)
print(vim.inspect(config))
local hl_enabled = config.icon_highlights.file_icon[name]
return function(self)
if hl_enabled == true or (type(hl_enabled) == "function" and hl_enabled(self)) then
return M.filetype_color(self)
end
end
end
I see that the config is empty:
.
This is wrong, since I have the following config for astroui:
return {
"AstroNvim/astroui",
---@type AstroUIOpts
opts = {
-- change colorscheme
colorscheme = "dracula",
-- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
highlights = {
init = { -- this table overrides highlights in all themes
-- Normal = { bg = "#000000" },
},
astrotheme = { -- a table of overrides/changes when applying the astrotheme theme
-- Normal = { bg = "#000000" },
},
},
status = {
-- Configure attributes of components defined in the `status` API. Check the AstroNvim documentation for a complete list of color names, this applies to colors that have `_fg` and/or `_bg` names with the suffix removed (ex. `git_branch_fg` as attributes from `git_branch`).
attributes = {
git_branch = { bold = true },
},
-- Configure colors of components defined in the `status` API. Check the AstroNvim documentation for a complete list of color names.
colors = {
git_branch_fg = "#ABCDEF",
},
-- Configure which icons that are highlighted based on context
icon_highlights = {
-- enable or disable breadcrumb icon highlighting
breadcrumbs = false,
-- Enable or disable the highlighting of filetype icons both in the statusline and tabline
file_icon = {
tabline = function(self) return self.is_active or self.is_visible end,
statusline = true,
},
},
-- Configure characters used as separators for various elements
separators = {
none = { "", "" },
left = { "", " " },
right = { " ", "" },
center = { " ", " " },
tab = { "", "" },
breadcrumbs = " ",
path = " ",
},
},
-- Icons can be configured throughout the interface
icons = {
-- configure the loading of the lsp in the status line
LSPLoading1 = "⠋",
LSPLoading2 = "⠙",
LSPLoading3 = "⠹",
LSPLoading4 = "⠸",
LSPLoading5 = "⠼",
LSPLoading6 = "⠴",
LSPLoading7 = "⠦",
LSPLoading8 = "⠧",
LSPLoading9 = "⠇",
LSPLoading10 = "⠏",
},
},
}
If I modify hl.lua on line 12, so that the definition of config becomes an inline function - resulting in the config is always re-evaluated, I see that the expected value, like this:
local config = function() return assert(require("astroui").config.status) end
and update uses of config to config(), I see the expected values when I print config from file_icon:
Converting to a function also fixes the error shown at the start of this issue, since config().icon_hightlights.file_icon[name] in hl.lua now has a valid value.
This feels like a timing issue, but I see that astroui has a priority of 1000 and is lazy = false, so I'd expect it to be already setup and ready to go by the time that I use it via my heirline config.
I'll try to debug some more later and narrow this down to a repro and update this issue - I just needed to get this out whilst I had the motivation to write it up!
Steps to Reproduce
todo
Expected behavior
n/a
Screenshots
No response
Additional Context
No response
Repro
No response
Investigating now, in the meantime I moved this to the correct repository
@lougreenwood can you please provide a minimal reproduction repro.lua that gets to this error? That will greatly help me in debugging. You can take a look at the template when opening a new issue on AstroNvim since I see that you deleted the one provided by default
Upon an initial investigation I cannot replicate this at all
Basically all of those modules are loaded post setup() call and therefore the config should be set fully before any of this code is running. We don't want to re-evaluate the config each time if that makes sense
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.