zbirenbaum / copilot-cmp

Lua plugin to turn github copilot into a cmp source
MIT License
1.07k stars 38 forks source link

Does not work on NixOS #68

Closed mbledkowski closed 10 months ago

mbledkowski commented 1 year ago

Hello, I am using NixOS, and NeoVim with LunarVim configuration, and I am getting this error:

Error executing vim.schedule lua callback: ...im/site/pack/lazy/opt/copilot.lua/lua/copilot/client.lua:51: [Copilot] Node.js not found
stack traceback:
        [C]: in function 'error'
        ...im/site/pack/lazy/opt/copilot.lua/lua/copilot/client.lua:51: in function 'get_node_version'
        ...im/site/pack/lazy/opt/copilot.lua/lua/copilot/client.lua:153: in function <...im/site/pack/lazy/opt/copilot.lua/lua/copilot/client.lua:148>

My plugin configuration looks like this:

lvim.plugins = {
  {
  "zbirenbaum/copilot-cmp",
  event = "InsertEnter",
  dependencies = { "zbirenbaum/copilot.lua" },
  config = function()
    vim.defer_fn(function()
      require("copilot").setup({
          copilot_node_command = "/run/current-system/sw/bin/node",
      }) -- https://github.com/zbirenbaum/copilot.lua/blob/master/README.md#setup-and-configuration
      require("copilot_cmp").setup() -- https://github.com/zbirenbaum/copilot-cmp/blob/master/README.md#configuration
    end, 100)
  end,
  },
}

Best regards mble

zbirenbaum commented 1 year ago

This has nothing to do with your OS, copilot is reporting an issue with running the command you supplied. Try running /run/current-system/sw/bin/node from cli and see if that actually runs node.

mbledkowski commented 1 year ago

Runs just fine image

MunifTanjim commented 1 year ago

https://github.com/zbirenbaum/copilot.lua/pull/164 added support for better startup error.