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

Unsure of how we got this failure

Open fgheng opened this issue 2 years ago • 5 comments

Description

Hello, there are some errors with copilot.vim, "Unsure of how we got this failure".

image

Neovim version

NVIM v0.8.0-dev+313-g7b952793d
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az220-948

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Operating system and version

arch linux

checkhealth telescope

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - WARNING: nvim-treesitter not found. 

## Checking external dependencies
  - OK: rg: found ripgrep 12.1.1
  - WARNING: fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

## ===== Installed extensions =====

Steps to reproduce

  1. nvim -nu minimal.lua
  2. (I have also configed copilot.vim, so skip this step )
  3. :Telescope
  4. enter <esc> to quit the telescope window
  5. press 'o' to create new row
  6. input any character and press tab after the character quickly, error will occured

Expected behavior

no error message

Actual behavior

telescope

Minimal config

vim.g.do_filetype_lua = 1
vim.g.did_load_filetypes = 0

local fn = vim.fn
local cmd = vim.cmd

local packer_boot_strap = false
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
    packer_boot_strap = fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
    if packer_boot_strap then
        cmd [[packadd packer.nvim]]
    else
        return
    end
end

require('packer').startup({ function(use)
    use { 'wbthomason/packer.nvim' }

    use { 'github/copilot.vim',
       event = 'InsertEnter',
        config = function()                                                                                                                                                
            vim.cmd[[                                                                                                                                                      
                let g:copilot_filetypes = {                                                                                                                                
                      \ 'TelescopeResults': v:false,                                                                                                                       
                      \ 'TelescopePrompt': v:false,                                                                                                                        
                      \ }                                                                                                                                                  
            ]]                                                                                                                                                             
        end  
    }

     use { 'nvim-telescope/telescope.nvim',
         config = function()
             require('telescope').setup()
         end,
         requires = {
             { 'nvim-lua/plenary.nvim' },
         },
         cmd = { 'Telescope' },
     }

    -- packer auto install if packer is installed for the first time
    if packer_boot_strap then
        require('packer').sync()
    end
end,
config = { -- packer using float window
    display = {
        open_fn = function()
            return require('packer.util').float({ border = 'single' })
        end
    }
}
})

fgheng avatar May 27 '22 15:05 fgheng

Did you try to disable all of Telescopes filetypes for copilot? TelescopePrompt and TelescopeResults?

https://github.com/github/copilot.vim/blob/ad102c7a58356414f18680f60c2298246e41ccea/doc/copilot.txt#L43-L59

Or even better only enable copilot for filetypes you need. Maybe that helps, if not i would install copilot and try it out myself

Conni2461 avatar May 29 '22 10:05 Conni2461

Yes, the problem still exists. I have changed the minimal config with 'g:copilot_filetypes'.

fgheng avatar May 29 '22 11:05 fgheng

Hmm okay i can reproduce. Its weird, i dont know why you can trigger a telescope mapping even thought we already closed that buffer. My only assumption right now is that these mappings are not yet cleaned fully cleaned up. I can remove that error message, but that only gonna "eat" the <Tab> keypress. Calling :mapclear <buffer> prior to deleting the buffer also didn't help

I need to investigate more, on what going wrong here.

Conni2461 avatar May 29 '22 11:05 Conni2461

I'm getting the exact same error message, but I'm using coc instead of copilot

Genius1512 avatar Jun 08 '22 10:06 Genius1512

i found out that <Tab> keymap was overrided by this tab

ruanyouxing avatar Jul 07 '22 17:07 ruanyouxing

Resolved this issue by removing event = "InsertEnter, then the key binding for <Tab> works as expected. image Suppose it is due to Copilot is forced to load before Telescope

xgugeng avatar Jan 10 '23 12:01 xgugeng

my solution is using copilot.lua

fgheng avatar Jan 12 '23 15:01 fgheng

I'm also getting this error. Tried installing copilot.lua but also having the same error.

For the time being, I have just remapped tab to behave as usual.

paulochoi avatar Jun 06 '23 01:06 paulochoi

@paulochoi If you are using Lazy.nvim for your package manager, this may help.

https://github.com/mskelton/dotfiles/commit/6cebc2d8b8d13eb622ba4054df49d9b05ae57ecf

The issue for me was that I was loading copilot after Telescope which caused issues with the mappings. Using VimEnter as the event for copilot ensured that it would load before Telescope with my config and then everything worked as normal.

Hope that helps!

mskelton avatar Jun 06 '23 02:06 mskelton

Thanks for that, you are right. Looks like copilot is loading after telescope here. I typically launch neovim with telescope find_files as a command and looks like when I do that, telescope is the first thing that loads and it is causing the problem.

Edit: For anyone coming accross from here, remapping tab according to this comment did it for me: https://github.com/LunarVim/LunarVim/issues/1856#issuecomment-954224770

paulochoi avatar Jun 06 '23 02:06 paulochoi

Can someone retest this. we actually might have fixed this issue, because we rewrote our mappings (latest master) and it might have fixed that issue because we no longer have a couple of hacks for mappings and the "Unsure of how we got this failure" code also no longer exists.

Conni2461 avatar Jun 09 '23 12:06 Conni2461

I have reverted my workaround and can confirm that the error no longer occurs. Thanks @Conni2461 and team!

paulochoi avatar Jun 09 '23 13:06 paulochoi

Thanks for retesting. If this issues comes back, feel free to reopen

Conni2461 avatar Jun 10 '23 15:06 Conni2461

This is fixed for me as well, thanks so much I really appreciate it!

marcellmueller avatar Jun 15 '23 14:06 marcellmueller