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

fix: do not setup more than once #3056

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FelisNivalis
Copy link

Description

related: #1628

Extensions, e.g. file_browser, merge default key mappings and user defined ones in their setups. the mappings contain actions which typically have __call and other metamethods.

However, when merging tables, vim.tbl_extend returns a table without a metatable. Thus vim.tbl_deep_extend({n = {g = action1}}, {n = {g = action2}}) will try to merge action1 and action2, but the returned table doesn't have metatables.

This is mainly an issue of vim.tbl_extend. I have opened an issue there, but it would be nice to also have things work without having to upgrade neovim.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Example config:

require('telescope').setup({
  extensions = {
    file_browser = {
      mappings = {n = {g = actions.close + my_action}}
    }
  }
})
telescope.load_extension("file_browser")

Trying to trigger the action will get an error: mappings.lua:290: attempt to call upvalue 'key_func' (a table value)

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (lua annotations)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant