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

copilot.lua + neovim 0.10.2 raise an error when completing line with CJK characters #329

Closed
wrvsrx opened this issue Oct 30, 2024 · 2 comments

Comments

@wrvsrx
Copy link

wrvsrx commented Oct 30, 2024

Reproduce

  1. Install copilot.lua with neovim 0.10.2 and setup it using following config (I use lazy.nvim to load it)

            {
                dir = "/nix/store/rwcag86gmdas1n3y0vz9wgc9alrhs5ia-lazy-plugins/copilot.lua",
                event = "VeryLazy",
                opts = {
                    copilot_node_command = "node",
                    filetypes = {
                        ["."] = false,
                        gitcommit = true,
                        gitrebase = true,
                        help = false,
                        markdown = true,
                        yaml = true,
                    },
                    panel = {
                        auto_refresh = true,
                        enabled = true,
                        keymap = { accept = "<CR>", jump_next = "]]", jump_prev = "[[", open = "<C-CR>", refresh = "gr" },
                        layout = { position = "bottom", ratio = 0.4 },
                    },
                    suggestion = {
                        auto_trigger = true,
                        debounce = 75,
                        enabled = true,
                        keymap = {
                            accept = "<c-c>a",
                            accept_line = "<c-c>l",
                            accept_word = "<c-c>w",
                            dismiss = "<c-c>d",
                            next = "<c-c>n",
                            prev = "<c-c>p",
                        },
                    },
                },
            },
  2. Create a file with CJK character and complete the line with CJK character using keymap (<c-c>a)

    #include <iostream>
    
    auto main() -> int {
      // 中|
      std::cout << "Hello, World!" << std::endl;
    }

    | is the cursor position

  3. copilot.lua raises an error

    image

Debug

I notice the problem is caused by this PR, I revert the in my fork and the error disappears. I don't understand the detail and hope this problem can be fixed on copilot.lua side.

@wrvsrx
Copy link
Author

wrvsrx commented Oct 30, 2024

The error disappears on neovim nightly. I think it might be a problem on neovim side.

@wrvsrx wrvsrx closed this as completed Oct 30, 2024
@wrvsrx
Copy link
Author

wrvsrx commented Oct 30, 2024

This error is fixed in this PR

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

1 participant