jellydn / CopilotChat.nvim

Chat with GitHub Copilot in Neovim
GNU General Public License v3.0
100 stars 9 forks source link

Ambiguous use of user-defined command #43

Closed bijancn closed 8 months ago

bijancn commented 8 months ago

Describe the bug

Just tried to install according to the README. When I try to run any command I get

Error executing Lua callback: vim/_editor.lua:0: nvim_exec2(): Vim:E464: Ambiguous use of user-defined command: CopilotChat Explain how it works.
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        ...hare/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:29: in function <...hare/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:28>
Press ENTER or type command to continue

I am using

  "CopilotChat.nvim": { "branch": "main", "commit": "9722cf72c486e14f739cbb7de07700d555ad8bc8" },

And this is the config for lazy

    {
        "jellydn/CopilotChat.nvim",
        dependencies = { "zbirenbaum/copilot.lua" }, -- Or { "github/copilot.vim" }
        opts = {
            mode = "split",                          -- newbuffer or split  , default: newbuffer
            debug = true,                            -- Enable or disable debug mode, the log file will be in ~/.local/state/nvim/CopilotChat.nvim.log
        },
        build = function()
            vim.defer_fn(function()
                vim.cmd("UpdateRemotePlugins")
                vim.notify("CopilotChat - Updated remote plugins. Please restart Neovim.")
            end, 3000)
        end,
        event = "VeryLazy",
        keys = {
            { "<leader>cce", "<cmd>CopilotChatExplain<cr>", desc = "CopilotChat - Explain code" },
            { "<leader>cct", "<cmd>CopilotChatTests<cr>",   desc = "CopilotChat - Generate tests" },
        },
    },

When I try to activate debug = true I still don't see anything in ~/.local/state/nvim/CopilotChat.nvim.log.

Reproduction

Config

System Info

Error executing Lua callback: vim/_editor.lua:0: nvim_exec2(): Vim:E464: Ambiguous use of user-defined command: CopilotChat Explain how it works.
stack traceback:
        [C]: in function 'nvim_exec2'
        vim/_editor.lua: in function 'cmd'
        ...hare/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:29: in function <...hare/nvim/lazy/CopilotChat.nvim/lua/CopilotChat/init.lua:28>
Press ENTER or type command to continue

Used Package Manager

n/a

Validations

jellydn commented 8 months ago

Hi @bijancn Probably, that is the same issue with #38. You need to run UpdateRemotePlugins and restart Neovim.

bijancn commented 8 months ago

Ahh. I'm sorry @jellydn . I did actually run the command but before I restarted Neovim, so the plugin wasn't installed yet. Maybe you could add an extra step about making sure it's installed before running UpdateRemotePlugins? It seems obvious but still easy to forget. Especially when one doesn't know what the command does 😇

jellydn commented 8 months ago

Ahh. I'm sorry @jellydn . I did actually run the command but before I restarted Neovim, so the plugin wasn't installed yet. Maybe you could add an extra step about making sure it's installed before running UpdateRemotePlugins? It seems obvious but still easy to forget. Especially when one doesn't know what the command does 😇

That's on readme: step 3 and 4.

image
bijancn commented 8 months ago

Okay maybe it's just me but when I

So for me I needed to