zbirenbaum / copilot.lua

Fully featured & enhanced replacement for copilot.vim complete with API for interacting with Github Copilot
MIT License
2.45k stars 67 forks source link

Starting RPC client spam and error when opening the Kitty settings page #132

Closed pprotas closed 1 year ago

pprotas commented 1 year ago

Whenever I try to open the Kitty settings pane and enter Insert mode, I am met with a huge spam of errors coming from this plugin:

image

[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}
[INFO][2023-02-23 22:43:47] .../vim/lsp/rpc.lua:662 "Starting RPC client"   {  args = { "/Users/pawel/.local/share/nvim/lazy/copilot.lua/copilot/index.js" },  cmd = "node",  extra = {}}

node -v output:

v19.3.0

My copilot.lua config:

  {
    "zbirenbaum/copilot.lua",
    cmd = "Copilot",
    event = "InsertEnter",
    keys = {
      {
        "<C-F>",
        function()
          require("copilot.suggestion").accept()
        end,
        desc = "Copilot Accept",
        mode = "i",
      },
    },
    opts = {
      suggestion = {
        auto_trigger = true,
        keymap = {
          accept = false,
        },
      },
      panel = { enabled = false },
    },
  },

When I disable this plugin, the error spam is gone.

The plugin works perfectly fine when running Neovim in any other place. Just this Kitty settings page has problems as far as I can tell.

MunifTanjim commented 1 year ago

What's the output of :Copilot version?

MunifTanjim commented 1 year ago

Also what is "Kitty settings pane"? 🤔 How do you open it?

MunifTanjim commented 1 year ago

Got it. It's https://sw.kovidgoyal.net/kitty/conf/#shortcut-kitty.Edit-config-file

It's not an issue with this plugin. Kitty resets the $PATH variable when running that command. Nothing we can do here. You should discuss it on Kitty's repo: https://github.com/kovidgoyal/kitty/discussions

pprotas commented 1 year ago

Amazing investigative work!

I understand now this is an issue on Kitty's side. Nevertheless, would it be possible to stop copilot.lua from excessively trying to call node when it is clear that it's not available in $PATH?

MunifTanjim commented 1 year ago

Nevertheless, would it be possible to stop copilot.lua from excessively trying to call node when it is clear that it's not available in $PATH?

Can you check https://github.com/zbirenbaum/copilot.lua/pull/133?

pprotas commented 1 year ago

I am not knowledgeable enough about this codebase to say anything about the code, but if it works then it works! Thanks for your time & effort.

MunifTanjim commented 1 year ago

No worries. I'm merging it. You can update the plugin and see if it works.

If it doesn't, comment here again and I'll re-open the issue.

pprotas commented 1 year ago

I can confirm this doesn't spam my console anymore.

Now I get this error every time I enter Insert mode: image

Which, I suppose, does fix my original problem.

Ideally (for me), this error would only show once, or not show up at all and instead just be logged somewhere. Afterwards it shouldn't show up every time I enter Insert mode.

For now there is a workaround for me: simply don't use the kitty settings window and instead just cd into the kitty conf folder and open nvim there.

MunifTanjim commented 1 year ago

Ideally (for me), this error would only show once

Yep, that was my intention too.

Can you please update the plugin again and see if the situation is improved?

pprotas commented 1 year ago

image

Clean! It just shows up once, and never shows up again. Perfect!

Thank you yet again.