heirline-components.nvim icon indicating copy to clipboard operation
heirline-components.nvim copied to clipboard

🐛bug: is_available failing when not using lazy

Open BANanaD3V opened this issue 8 months ago • 4 comments

Neovim version (nvim -v)

0.10.4

Operating system/version

NixOS

Describe the bug

I'm using nvf to configure my neovim and compiler_play or neotree components for winbar are not showing icons. I suspect this is because i don't have lazy and utils reference lazy to see if the plugin is available. I've tried overriding the condition, but it didn't work.

Steps To Reproduce

  1. Don't use lazy
  2. Add neotree component to your winbar (having neotree installed)

Expected Behavior

The icon shows up

Current Behavior

The icon doesn't show up

Minimal init.lua

Not using lazy. https://github.com/BANanaD3V/Lumi/blob/main/config/plugins/ui/heirline.nix this is how i define my heirline config.

More info

Why can't i override condition?

BANanaD3V avatar Mar 07 '25 11:03 BANanaD3V

@BANanaD3V If I understand correctly the bug is on the component https://github.com/Zeioth/heirline-components.nvim/wiki/neotree

The relevant bits of source code are:

  • https://github.com/Zeioth/heirline-components.nvim/blob/935f29dabd86f2669e0b3c8dd283b2d3b1cfaee7/lua/heirline-components/core/component.lua#L834
  • https://github.com/Zeioth/heirline-components.nvim/blob/935f29dabd86f2669e0b3c8dd283b2d3b1cfaee7/lua/heirline-components/core/provider.lua#L824

The function get_icon is also involved but as you can see there is not much there. https://github.com/Zeioth/heirline-components.nvim/blob/935f29dabd86f2669e0b3c8dd283b2d3b1cfaee7/lua/heirline-components/utils.lua#L24

There is a good chance tweaking the option icons you can make them display: https://github.com/Zeioth/heirline-components.nvim/wiki/icons

Zeioth avatar Mar 07 '25 13:03 Zeioth

I think its is_available, as in the code it uses lazy to see if the plugin is loaded. I dont use lazy.

BANanaD3V avatar Mar 07 '25 15:03 BANanaD3V

https://github.com/Zeioth/heirline-components.nvim/blob/935f29dabd86f2669e0b3c8dd283b2d3b1cfaee7/lua/heirline-components/utils.lua#L50C1-L51C71 here

BANanaD3V avatar Mar 07 '25 15:03 BANanaD3V

I was able to override the conditon like that:

                lib.component.neotree({
                  neotree = {
                    condition = function() return true end,
                  },
                }),

But it still leaves the issue of not working without lazy. In my opinion those conditions are not needed as people will know what plugins they have when adding modules.

BANanaD3V avatar Mar 07 '25 15:03 BANanaD3V