Skip to content
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

git plugin: nvim_get_hl must not be called in a lua loop callback. #101

Open
sax opened this issue Feb 5, 2025 · 1 comment
Open

git plugin: nvim_get_hl must not be called in a lua loop callback. #101

sax opened this issue Feb 5, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@sax
Copy link

sax commented Feb 5, 2025

Describe the bug

After updating to the latest neovim and kyazdani42/nvim-web-devicons I get the following error from sidebar's git plugin, when I have an untracked file with an extension:

Error executing luv callback:
...packer/start/nvim-web-devicons/lua/nvim-web-devicons.lua:144: E5560: nvim_get_hl must not be called in a lua loop callback
stack traceback:
        [C]: in function 'nvim_get_hl'
        ...packer/start/nvim-web-devicons/lua/nvim-web-devicons.lua:144: in function 'highlight_exists'
        ...packer/start/nvim-web-devicons/lua/nvim-web-devicons.lua:387: in function 'get_icon_colors'
        ...packer/start/nvim-web-devicons/lua/nvim-web-devicons.lua:401: in function 'get_icon_color'
        ...cker/start/sidebar.nvim/lua/sidebar-nvim/builtin/git.lua:80: in function 'parse_fn'
        ...cker/start/sidebar.nvim/lua/sidebar-nvim/builtin/git.lua:132: in function <...cker/start/sidebar.nvim/lua/sidebar-nvim/builtin/git.lua:125>

To Reproduce
Steps to reproduce the behavior:

  1. mkdir -p /tmp/sandbox
  2. cd /tmp/sandbox
  3. git init
  4. touch file.exs, or touch file.rs
  5. nvim .
  6. See error

Environment:

  • nvim --version
    NVIM v0.10.4
    Build type: Release
    LuaJIT 2.1.1736781742
    
  • sidebar setup
require'nvim-web-devicons'.setup()

local sidebar = require("sidebar-nvim")
local opts = {
  diagnostics = {
  },
  git = {
  },
  files = {
    show_hidden = true,
    ignored_paths = { "%.git$", "%.elixir_ls$", "%.iex-history$" }
  },
  open = false,
  sections = { "git", "diagnostics", "files", "symbols" },
  section_separator = { "_________________", "" },
  symbols = {
  }
}
sidebar.setup(opts)

vim.api.nvim_set_keymap("n", "<leader><tab>", ":SidebarNvimToggle<CR>", { noremap = true})
@sax sax added the bug Something isn't working label Feb 5, 2025
@sax
Copy link
Author

sax commented Feb 12, 2025

I pinned nvim-web-devicons to a specific sha to avoid the issue: 37334ad.

I would be happy to contribute to a fix, but my facility in Lua is pretty lacking. I think I would need guidance towards the most appropriate fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant