Skip to content

fix(#572, #575): ensure icon overrides apply after refresh #576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

dsaenztagarro
Copy link
Contributor

@dsaenztagarro dsaenztagarro commented Apr 6, 2025

Resolves #572 (original issue)
Resolves #575 (reported bug)

What I did

I reapplied the changes from #572.

In addition, I fixed the reported bug with 37078ee.

How to reproduce the bug

I configured locally the plugin so I simulate I "require" the plugin from other plugin as dependency, but without calling "setup".

return {
  'nvim-tree/nvim-web-devicons',
  dir="/Users/dsaenz/Code/nvim-web-devicons",
  dev = true,
  config = function()
    require'nvim-web-devicons'
  end
}

With this, when I open NeoVim I got exactly the same error reported by the user:

Screenshot 2025-04-07 at 01 38 16

Explanation

Because setup was not called, user_icons was not initialized properly. As result, calling apply_user_icons from the auto command was 🧨 .

@dsaenztagarro dsaenztagarro changed the title Fix user icon overrides on refresh (Bug fixed) fix: user icon overrides on refresh (Bug fixed) Apr 7, 2025
@@ -132,6 +132,7 @@ return {
["odin"] = "odin",
["openscad"] = "scad",
["opus"] = "opus",
["org"] = "org",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

function M.setup(opts)
if loaded then
local function apply_user_icons()
if type(user_icons) ~= "table" then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the safest course of action, it maintains existing behaviour.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for the quick fix.

@alex-courtis alex-courtis changed the title fix: user icon overrides on refresh (Bug fixed) fix(#572, #575): ensure icon overrides apply after refresh Apr 7, 2025
@alex-courtis alex-courtis merged commit 57dfa94 into nvim-tree:master Apr 7, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants