nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.98k stars 837 forks source link

key found in more than one map #2569

Closed z3tsubouou closed 1 year ago

z3tsubouou commented 1 year ago

Description

I was messing around Shopify project and opened package.json everything was right until I tried to open another file then the below error showed up.

E5108: Error executing lua ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:752: BufEnter Autocommands for "package.json": Vim(lua):E5108: Error executing lua vim/shared.l
ua:0: key found in more than one map: cross-env
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'tbl_extend'
        ...cker/start/package-info.nvim/lua/package-info/parser.lua:12: in function 'parse_buffer'
        ...packer/start/package-info.nvim/lua/package-info/core.lua:52: in function 'load_plugin'
        [string ":lua"]:1: in main chunk
        [C]: in function 'nvim_win_close'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:752: in function 'close_windows'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1487: in function 'on_close_prompt'
        ...acker/start/telescope.nvim/lua/telescope/actions/set.lua:134: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'nvim_win_close'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:752: in function 'close_windows'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1487: in function 'on_close_prompt'
        ...acker/start/telescope.nvim/lua/telescope/actions/set.lua:134: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

Neovim version

NVIM v0.9.0
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

macOS Ventura 13.4

Telescope version / branch / rev

telescope 1.1

checkhealth telescope

telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fd 8.4.0

Steps to reproduce

  1. yarn create @shopify/hydrogen
  2. Select demo template
  3. Select typescript
  4. Install dependencies with yarn? (yes)
  5. yarn dev
  6. open package.json file
  7. try to open any other file using find files.

Expected behavior

open file

Actual behavior

E5108: Error executing lua ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:752: BufEnter Autocommands for "package.json": Vim(lua):E5108: Error executing lua vim/shared.l
ua:0: key found in more than one map: cross-env
stack traceback:
        [C]: in function 'error'
        vim/shared.lua: in function 'tbl_extend'
        ...cker/start/package-info.nvim/lua/package-info/parser.lua:12: in function 'parse_buffer'
        ...packer/start/package-info.nvim/lua/package-info/core.lua:52: in function 'load_plugin'
        [string ":lua"]:1: in main chunk
        [C]: in function 'nvim_win_close'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:752: in function 'close_windows'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1487: in function 'on_close_prompt'
        ...acker/start/telescope.nvim/lua/telescope/actions/set.lua:134: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk
stack traceback:
        [C]: in function 'nvim_win_close'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:752: in function 'close_windows'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:1487: in function 'on_close_prompt'
        ...acker/start/telescope.nvim/lua/telescope/actions/set.lua:134: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'run_replace_or_original'
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func'
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:352: in function 'execute_keymap'
        [string ":lua"]:1: in main chunk

Minimal config

vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
  require('packer').startup {
    {
      'wbthomason/packer.nvim',
      {
        'nvim-telescope/telescope.nvim',
        requires = {
          'nvim-lua/plenary.nvim',
          { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' },
        },
      },
      -- ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
    },
    config = {
      package_root = package_root,
      compile_path = install_path .. '/plugin/packer_compiled.lua',
      display = { non_interactive = true },
    },
  }
end
_G.load_config = function()
  require('telescope').setup()
  require('telescope').load_extension('fzf')
  -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
end
if vim.fn.isdirectory(install_path) == 0 then
  print("Installing Telescope and dependencies.")
  vim.fn.system { 'git', 'clone', '--depth=1', 'https://github.com/wbthomason/packer.nvim', install_path }
end
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerComplete ++once echo "Ready!" | lua load_config()]]
Conni2461 commented 1 year ago

can you retest with latest stable 0.1.2 or latest master (not 0.1.1) because we've rewritten our mapping code and that fixed quite a lot of edge case bugs. The error lines also point to source code that no longer exists.

Maybe that solves your problem. Still thanks for reporting :)

z3tsubouou commented 1 year ago

I have updated to the 0.1.2 version and this error is still occurring. I think the code is broking because of the "cross-env" word.

z3tsubouou commented 1 year ago

Maybe this is a Neovim error because this error occurred when I opened the file using only Neovim.

jamestrew commented 1 year ago

@z3tsubouou that's pretty unlikely... you were able to replicate this using the minimal config? I just tried and it works just fine for me.

z3tsubouou commented 1 year ago

I found a real cause. Cross-env package was in both dependencies and devDependencies section and causing this error. Once I removed one line everything was working smoothly.

  "dependencies": {
    "cross-env": "^7.0.3",
  },
  "devDependencies": {
    "cross-env": "^7.0.3",
  },
z3tsubouou commented 1 year ago

This is another package bug thank you all. :)