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

"Show mappings for picker actions" shows error message #2734

Closed
ingur opened this issue Oct 10, 2023 · 13 comments
Closed

"Show mappings for picker actions" shows error message #2734

ingur opened this issue Oct 10, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@ingur
Copy link

ingur commented Oct 10, 2023

Description

I keep getting this error:

Error  01:06:09 AM msg_show.lua_error Error executing vim.schedule lua callback: .../nvim/lazy/telescope.nvim/lua/telescope/actions/init.lua:1273: Invalid 'event': 'User TelescopeKeymap'
stack traceback:
	[C]: in function 'nvim_create_autocmd'
	.../nvim/lazy/telescope.nvim/lua/telescope/actions/init.lua:1273: in function <.../nvim/lazy/telescope.nvim/lua/telescope/actions/init.lua:1272>

Whenever I use ? in normal mode to show the mappings for any telescope picker. The mappings will still show, but the menu stays behind until u toggle it again.

image
image

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794

and

NVIM v0.10.0-dev-c40a1c0
Build type: RelWithDebInfo
LuaJIT 2.1.1696795921

Operating system and version

Pop!_OS 22.04 LTS

Telescope version / branch / rev

0.1.x

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.3.1

===== Installed extensions ===== ~

Telescope Extension: `file_browser` ~
- No healthcheck provided

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `project` ~
- No healthcheck provided

Steps to reproduce

  1. nvim -nu minimal.lua
  2. :telescope
  3. ?

Expected behavior

Should show the keymaps like usual, without an error message

Actual behavior

Shows an error message

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()]]
@ingur ingur added the bug Something isn't working label Oct 10, 2023
@ZhuX96
Copy link

ZhuX96 commented Oct 11, 2023

Similar issue

happens when I use builtin.find_files

Description

E5108: Error executing lua: ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:347: Invalid 'event': 'User TelescopeFindPre'
stack traceback:
        [C]: in function 'nvim_exec_autocmds'
        ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:347: in function 'find'
        ...r/start/telescope.nvim/lua/telescope/builtin/__files.lua:305: in function 'v'
        ...r/start/telescope.nvim/lua/telescope/builtin/__files.lua:529: in function 'v'
        ...cker/start/telescope.nvim/lua/telescope/builtin/init.lua:514: in function <...cker/start/telescope.nvim/lua/telescope/builtin/init.lua:483>
Press ENTER or type command to continue

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
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extened capabilities

===== Installed extensions ===== ~

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Config file

plugins.lua

local telescope_status, telescope = pcall(require, 'telescope')
if not telescope_status then
  print('Failed to require telescope')
  return
end

local telescope_actions_status, telescope_actions = pcall(require, "telescope.actions")
if not telescope_actions_status then
  print('Failed to require telescode.actions')
  return
end

telescope.setup {}
telescope.load_extension("fzf")

local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})

@obszczymucha
Copy link

This is the temporary fix, but it's probably not the cleanest solution. You can at least get your Telescope working for now:

diff --git a/lua/telescope/mappings.lua b/lua/telescope/mappings.lua
index 45fad81..cd18bcf 100644
--- a/lua/telescope/mappings.lua
+++ b/lua/telescope/mappings.lua
@@ -350,7 +350,7 @@ mappings.execute_keymap = function(prompt_bufnr, keymap_identifier)
   assert(key_func, string.format("Unsure of how we got this failure: %s %s", prompt_bufnr, keymap_identifier))
 
   key_func(prompt_bufnr)
-  vim.api.nvim_exec_autocmds("User TelescopeKeymap", {})
+  pcall(function() vim.api.nvim_exec_autocmds("User TelescopeKeymap", {}) end)
 end
 
 mappings.clear = function(prompt_bufnr)
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index 5019abf..a0d4c65 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -344,7 +344,7 @@ function Picker:find()
   self.original_win_id = a.nvim_get_current_win()
 
   -- User autocmd run it before create Telescope window
-  vim.api.nvim_exec_autocmds("User TelescopeFindPre", {})
+  pcall(function() vim.api.nvim_exec_autocmds("User TelescopeFindPre", {}) end)
 
   -- Create three windows:
   -- 1. Prompt window

@Conni2461
Copy link
Member

Conni2461 commented Oct 11, 2023

Ill look into it and provide a fix for current master + 0.1.x + new release, in the next few minutes.

@Conni2461
Copy link
Member

@obszczymucha @ZhuX96 i cant reproduce your bugs with the latest stable release (0.1.3), the bug is present in 0.1.1

Please make sure to update to the latest stable release 0.1.3 or 0.1.4 once released

@Conni2461
Copy link
Member

CC @ingur fix for your bug #2736

@Conni2461
Copy link
Member

Conni2461 commented Oct 11, 2023

also fixed in 0.1.x (0.1.4 is published) thanks for reporting :)

@addz
Copy link

addz commented Oct 11, 2023

❤️ 👨‍🎤
Just hit this too on Arch, found this, changed version and pulled your fix.

Thank you for a fast response and an awesome plugin! You rock! 🎸

@after-ephemera
Copy link

Updating to 0.1.4 worked for me, thank you!

@tjex
Copy link

tjex commented Oct 18, 2023

Also worked for me 🙏 Legends!

@perrness
Copy link

Im still experiencing this issue running on 0.1.x and nvim 0.9.4, trying to run :Telescope find_files for example

E5108: Error executing lua ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:347: Invalid 'event': 'User TelescopeFindPre' stack traceback: [C]: in function 'nvim_exec_autocmds' ...ck/packer/start/telescope.nvim/lua/telescope/pickers.lua:347: in function 'find' ...r/start/telescope.nvim/lua/telescope/builtin/__files.lua:305: in function 'v' ...r/start/telescope.nvim/lua/telescope/builtin/__files.lua:529: in function 'v' ...cker/start/telescope.nvim/lua/telescope/builtin/init.lua:514: in function 'find_files' [string ":lua"]:1: in main chunk

Healthchecks:


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.7.0

===== Installed extensions ===== ~

@jamestrew
Copy link
Contributor

If you're still experiencing this issue Invalid 'event': 'User TelescopeFindPre' on line 347 of pickers.lua you are still on an outdated version of telescope. This line doesn't exist on "newer" versions of telescope.

Be extra sure that you've upgraded telescope to at least tag 0.1.3+ or are on branch 0.1.x or master branch.

@ArunPresent
Copy link

I might be late here, but installing ripgrep may help

@AlfredWilmot
Copy link

Im still experiencing this issue running on 0.1.x and nvim 0.9.4, trying to run :Telescope find_files for example

Do you have require('packer').sync() in your config?
If not then you'll have to run :PackerSync to get the update.
What worked for me was to change the tag from 0.1.1 to 0.1.4 in the part of my lua config specifying the telescope version (e.g. 'nvim-telescope/telescope.nvim', tag = '0.1.4'), and then running :PackerSync.

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