telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

QuickFixCmdPost Conflict Resulting in Error E776

Open hmgle opened this issue 1 year ago • 1 comments

Description

I have noticed that the code in telescope.nvim may lead to a problem:

  vim.api.nvim_exec_autocmds("QuickFixCmdPost", {})

If the user's configuration or other plugins (e.g., go.nvim) define similar code like this:

au QuickFixCmdPost    l* nested lwindow

When editing a file starting with the letter "l" and triggering the actions.smart_send_to_qflist function, an error "Error detected while processing QuickFixCmdPost Autocommands for 'l*': E776: No location list" occurs.

Neovim version

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

Operating system and version

Arch Linux / macOS 10.15.7

Telescope version / branch / rev

2e1e382

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

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

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

Telescope Extension: `yank_history` ~
- No healthcheck provided

Steps to reproduce

  1. Open a Go file starting with the letter "l".
  2. Move the cursor to any variable or function.
  3. Trigger the Telescope lsp_references include_current_line=true command using gr or other shortcuts.
  4. Use q or other shortcuts to trigger actions.smart_send_to_qflist + actions.open_qflist on the popped-up window.

Expected behavior

No response

Actual behavior

Error detected while processing QuickFixCmdPost Autocommands for "l*":
E776: No location list
Press ENTER or type command to continue

Minimal config

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable",
    lazypath,
  })
end

require("lazy").setup({
    {
        'nvim-telescope/telescope.nvim',
        config = function()
            require('config.telescope')
        end,
        enabled = true,
    },
    {
        'ray-x/go.nvim',
        config = function()
            require('go').setup()
        end
    },
})

require('telescope').setup{
  defaults = {
    mappings = {
      i = {
        ["<C-h>"] = "which_key"
      }
    }
  },
  pickers = {
  },
  extensions = {
  }
}

hmgle avatar Feb 27 '24 16:02 hmgle

I have the same issue.

This happens to me because I have the following auto commands:

-- Open the location list window if the quickfix command starts with an 'l'.
-- This applies to :lgrep, :lvimgrep, :lmake, etc.
autocmd('QuickFixCmdPost', { group = group, pattern = 'l*', command = ':lwindow' })
-- Open the quickfix list window if the quickfix command doesn't start with an 'l'.
-- This applies to :grep, :vimgrep, :make, etc.
autocmd('QuickFixCmdPost', { group = group, pattern = '[^l]*', command = ':cwindow' })

This PR fixed the issue for me: https://github.com/nvim-telescope/telescope.nvim/pull/2958

itaranto avatar Jun 14 '25 15:06 itaranto