zbirenbaum / copilot.lua

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

Failed to load `custom.plugins.copilot` #256

Closed jemiller1963 closed 5 months ago

jemiller1963 commented 6 months ago

Hi,

I am trying to get "zbirenbaum/copilot.lua" installed but I continue to get errors. I am using the post as reference:

https://tamerlan.dev/setting-up-copilot-in-neovim-with-sane-settings/

Here is the output from the :checkhealth command:

lazy: require("lazy.health").check()

lazy.nvim ~
- OK Git installed
- OK no existing packages found by other package managers
- OK packer_compiled.lua not found
- WARNING {nvim-lspconfig}: overriding <config>
- ERROR Issues were reported when loading your specs:
- ERROR Failed to load `custom.plugins.copilot`
- ERROR 
- ERROR /Users/jem/.config/nvim/lua/custom/plugins/copilot.lua:1: module 'copilot' not found:
- ERROR     no field package.preload['copilot']
- ERROR cache_loader: module copilot not found
- ERROR cache_loader_lib: module copilot not found
- ERROR     no file './copilot.lua'
- ERROR     no file '/usr/local/share/luajit-2.1.0-beta3/copilot.lua'
- ERROR     no file '/usr/local/share/lua/5.1/copilot.lua'
- ERROR     no file '/usr/local/share/lua/5.1/copilot/init.lua'
- ERROR     no file './copilot.so'
- ERROR     no file '/usr/local/lib/lua/5.1/copilot.so'
- ERROR     no file '/usr/local/lib/lua/5.1/loadall.so'
- ERROR 
- ERROR # stacktrace:
- ERROR   - lua/custom/plugins/copilot.lua:1
- ERROR   - lua/plugins/init.lua:273
- ERROR   - init.lua:21

Here is my lua/custom/plugin/plugin.lua file:

local overrides = require "custom.overrides"

local plugins = {

  {
    "zbirenbaum/copilot.lua",
    cmd = "Copilot",
    event = "InsertEnter",
  },

Output when I run :Copilot auth

Error executing Lua callback: ...local/share/nvim/lazy/copilot.lua/lua/copilot/client.lua:129: copilot.setup is not called yet
stack traceback:
        [C]: in function 'error'
        ...local/share/nvim/lazy/copilot.lua/lua/copilot/client.lua:129: in function 'use_client'
        ...em/.local/share/nvim/lazy/copilot.lua/plugin/copilot.lua:45: in function <...em/.local/share/nvim/lazy/copilot.lua/plugin/copilot.lua:8
>

If anyone can review these errors and have any words of wisdom, I would appreciate it.

Thanks!

9mm commented 5 months ago

Did you try calling setup? Here's my config:

return {
  "zbirenbaum/copilot.lua",
  cmd = "Copilot",
  event = "InsertEnter",
  config = function()
    require("copilot").setup({
      suggestion = {
        auto_trigger = true,
        debounce = 100,
        keymap = {
          accept = "<C-l>",
        },
      },
      filetypes = {
        css = true,
        eruby = true,
        go = true,
        html = true,
        javascript = true,
        lua = true,
        php = true,
        ruby = true,
        rust = true,
        typescript = true,
        vue = true,
        ["*"] = false,
      },
      server_opts_overrides = {},
    })
  end,
}
MunifTanjim commented 5 months ago

Yep, as the error says copilot.setup is not called yet, you'll need to call the setup function.