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

Accept suggestion results in Range too large error #244

Open
RobinClowers opened this issue Nov 29, 2023 · 5 comments
Open

Accept suggestion results in Range too large error #244

RobinClowers opened this issue Nov 29, 2023 · 5 comments

Comments

@RobinClowers
Copy link

RobinClowers commented Nov 29, 2023

I just set this plugin up, and tried the simplest thing.

function sum(a: number, b: number) {
	// here I invoked the next function with <M-]>
}

It generated the suggestion just fine, but when I tried to accept it with <M-l>, I get this error:

E5108: Error executing lua: Vim:E945: Range too large in character class
stack traceback:
        [C]: in function 'substitute'
        ...ocal/share/nvim/plugged/copilot.lua/lua/copilot/util.lua:300: in function 'strutf16len'
        ...hare/nvim/plugged/copilot.lua/lua/copilot/suggestion.lua:463: in function 'fn'
        ...hare/nvim/plugged/copilot.lua/lua/copilot/suggestion.lua:32: in function 'with_client'
        ...hare/nvim/plugged/copilot.lua/lua/copilot/suggestion.lua:460: in function <...hare/nvim/plugged/copilot.lua/lua/copilot/suggestion.lua:445>

I suspect I'm doing something wrong here, since this plugin is working for other folks. I'm using vim-plug and calling setup from a vimrc file, like this:

call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
" ... other plugins

Plug 'zbirenbaum/copilot.lua'

call plug#end()

" Initialize github copilot
lua require('copilot').setup({})
@MunifTanjim
Copy link
Collaborator

What's the output of :Copilot version?

@RobinClowers
Copy link
Author

Neovim 0.9.1
copilot.vim 1.12.1
copilot.lua 3665ed0f3ef3ad68673df7195789d134d0d1fdb0
copilot/dist/agent.js 1.138.0
Node.js 18.17.1

@RobinClowers
Copy link
Author

FYI I just upgraded neovim to 0.9.4 and I still get the same result.

@mr-mustash
Copy link

mr-mustash commented Dec 13, 2023

May be related, but I'm getting this error happens to me whenever I try to accept a suggestion:

[Copilot] failed to notify_accepted for:                         kill = "<C-c>",
Error: Vim:E945: Range too large in character class

The text is still entered into the buffer, but that error comes up every time I accept that suggestion.

Here is my version info:

Neovim 0.9.4
copilot.vim 1.12.1
copilot.lua 38a41d0d78f8823cc144c99784528b9a68bdd608
copilot/dist/agent.js 1.138.0
Node.js 21.4.0

And my configuration with lazy.nvim:

return {
    {
        "zbirenbaum/copilot.lua",
        cmd = "Copilot",
        event = "InsertEnter",
        config = function ()
            require('copilot').setup({
                  panel = {
                    enabled = false,
                },
                suggestion = {
                    enabled = true,
                    auto_trigger = true,
                    debounce = 75,
                    keymap = {
                        accept = "<C-k>",
                    },
                },
                filetypes = {
                    commit = false,
                    cvs = false,
                    git = false,
                    gitcommit = false,
                    gitrebase = false,
                    gitsendmail = false,
                    help = false,
                    hgcommit = false,
                    markdown = false,
                    md = false,
                    mkd = false,
                    svn = false,
                    tex = false,
                    text = false,
                    yaml = false,
                },
            })
        end
    }
}

@sakithb
Copy link

sakithb commented Jan 28, 2024

Same here

Neovim 0.9.5
copilot.vim 1.13.0
copilot.lua b03617a6dc4bc88b65ab5deac1631da9a9c2dcaf
copilot/dist/agent.js 1.141.0
Node.js 21.3.0

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

No branches or pull requests

4 participants