utilyre / barbecue.nvim

Visual Studio Code inspired breadcrumbs plugin for the Neovim editor
MIT License
807 stars 35 forks source link

`E5108: Error executing lua vim/shared.lua:0: after the second argument: expected table, got nil` #15

Closed hanselch closed 1 year ago

hanselch commented 1 year ago

Have all the dependencies and updated them all, used Plug to install both barbecue and it's dependencies. Still popping up this error:

E5108: Error executing lua vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'tbl_deep_extend'
        ...oload/plugged/barbecue.nvim/lua/barbecue/config/init.lua:21: in function 'apply'
        ...vim/autoload/plugged/barbecue.nvim/lua/barbecue/init.lua:65: in function 'setup'

Looks like the argument table wasn't used. Referring to these two:

function Config.prototype:apply(cfg)
  self.user = vim.tbl_deep_extend("force", self.template, cfg)
end
function M.setup(cfg)
  config:apply(cfg)
  --- ...
utilyre commented 1 year ago

I've done some major refactoring recently. Would you mind updating to the latest commit and leaving the error message again?

hanselch commented 1 year ago
E5108: Error executing lua vim/shared.lua:0: after the second argument: expected table, got nil
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'validate'
        vim/shared.lua: in function 'tbl_deep_extend'
        ...oload/plugged/barbecue.nvim/lua/barbecue/config/init.lua:13: in function 'apply_config'
        ...vim/autoload/plugged/barbecue.nvim/lua/barbecue/init.lua:31: in function 'setup'
        [string ":lua"]:2: in main chunk

Referring again to the two:

...oload/plugged/barbecue.nvim/lua/barbecue/config/init.lua:13: in function 'apply_config'

---merges `cfg` into `template` and sets it as `user`
---@param cfg BarbecueTemplateConfig
function M.apply_config(cfg)
  M.user = vim.tbl_deep_extend("force", template, cfg)
end

...vim/autoload/plugged/barbecue.nvim/lua/barbecue/init.lua:31: in function 'setup'

---configures and starts barbecue
---@param cfg BarbecueTemplateConfig
function M.setup(cfg)
  config.apply_config(cfg)
  config.resort_highlights()

Don't know if this is important, but I am using the recent update to WSL2. Heard many plugins not working properly cause of WSL2 venv.

insomnia-creator commented 1 year ago

Same here:

packer.nvim: Error running config for barbecue.nvim: vim/shared.lua:0: after the second argument: expected table, got nil

Neovim version NVIM v0.9.0-dev-16-g56998feeb Compiled it myself.

utilyre commented 1 year ago

Should be fixed now.

insomnia-creator commented 1 year ago

I'll check it out.

hanselch commented 1 year ago

Sorry for the late reply


E5108: Error executing lua ...vim/autoload/plugged/barbecue.nvim/lua/barbecue/init.lua:37: unexpected event
stack traceback:
        [C]: in function 'nvim_create_autocmd'
        ...vim/autoload/plugged/barbecue.nvim/lua/barbecue/init.lua:37: in function 'setup'
        [string ":lua"]:2: in main chunk

This time, the nvim_create_autocmd is giving trouble here:

if config.user.attach_navic then
    vim.api.nvim_create_autocmd("LspAttach", { -- <--- Possibly here?
      group = augroup,
      callback = function(a)
        local client = vim.lsp.get_client_by_id(a.data.client_id)
        if client.server_capabilities["documentSymbolProvider"] then navic.attach(client, a.buf) end
      end,
    })
  end

Might be something to do w/ LspAttach?

utilyre commented 1 year ago

Sorry for the late reply

E5108: Error executing lua ...vim/autoload/plugged/barbecue.nvim/lua/barbecue/init.lua:37: unexpected event
stack traceback:
        [C]: in function 'nvim_create_autocmd'
        ...vim/autoload/plugged/barbecue.nvim/lua/barbecue/init.lua:37: in function 'setup'
        [string ":lua"]:2: in main chunk

This time, the nvim_create_autocmd is giving trouble here:

if config.user.attach_navic then
    vim.api.nvim_create_autocmd("LspAttach", { -- <--- Possibly here?
      group = augroup,
      callback = function(a)
        local client = vim.lsp.get_client_by_id(a.data.client_id)
        if client.server_capabilities["documentSymbolProvider"] then navic.attach(client, a.buf) end
      end,
    })
  end

Might be something to do w/ LspAttach?

Could you open another issue and include what version of neovim you are using?

utilyre commented 1 year ago

I'll close this thread since this specific issue has been solved.

hanselch commented 1 year ago

Mkay, it was a mistake in my end, didn't updated neovim to v0.8+.

Thought I've update 0.8 since it was released in back in September. The AppImage didn't compile it correctly (maybe made it unsafe too...).

I am so sorry for this unnecessary goose chase. Though now it looking back from the past releases, optimization has improved! So these changes is an improvement!

Again, I am so sorry for the massive wild goose chase!

insomnia-creator commented 1 year ago

I was on v0.9 and this error still happened to me.

utilyre commented 1 year ago

I was on v0.9 and this error still happened to me.

I suppose you mean the LspAttach error. If that's the case consider opening another issue for that.

insomnia-creator commented 1 year ago

It was the exact same error @hanselch had. It was working fine after the commit fixing the said issue