abzcoding / lvim

🧑‍🚀 Bloated LunarVim 🚀
MIT License
471 stars 65 forks source link

does copilot.lua works for you? #100

Closed luxus closed 1 year ago

luxus commented 1 year ago

i tried the lua version with cmp of copilot, but i struggle to get it working .. i got the message Copilot is not running. when i enter :Copilot auth (i opened a py file) the normal tpope version works fine

abzcoding commented 1 year ago

i don't use copilot.lua,but i think we might need to move a couple of things around since lunarvim has done some stuff to make cmp+copilot integration easier

luxus commented 1 year ago
diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua
index f569399..0c7ebde 100644
--- a/lua/user/plugins.lua
+++ b/lua/user/plugins.lua
@@ -387,17 +387,25 @@ M.config = function()
     },
     {
       "zbirenbaum/copilot.lua",
-      after = "nvim-cmp",
-      requires = { "zbirenbaum/copilot-cmp" },
+      event = { "VimEnter" },
       config = function()
-        local cmp_source = { name = "copilot", group_index = 2 }
-        table.insert(lvim.builtin.cmp.sources, cmp_source)
         vim.defer_fn(function()
-          require("copilot").setup()
+          require("copilot").setup {
+            plugin_manager_path = os.getenv "LUNARVIM_RUNTIME_DIR" .. "/site/pack/packer",
+          }
         end, 100)
       end,
       disable = not lvim.builtin.sell_your_soul_to_devil.prada,
     },
+
+    {
+      "zbirenbaum/copilot-cmp",
+      after = { "copilot.lua" },
+      config = function()
+        require("copilot_cmp").setup()
+      end,
+      disable = not lvim.builtin.sell_your_soul_to_devil.prada,
+    },
     {
       "ThePrimeagen/harpoon",
       requires = {

something like this... i just copied some stuff around :D

and added this

lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)"
table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" })

to the config

but it stills not really works.. really strange :(

rebuilt commented 1 year ago

I'd check the lsp logs. I initially set up zbirenbaum/copilot-cmp and it worked for a while but at some point it stopped working. I switched back to tpope's version and it threw more explicit error messages about my version of node. At the time I think it only worked with version 12 of node. So I downgraded node and got it working.

I probably didn't need to switch plugins, just downgrade my node version.

alechp commented 1 year ago

Update

lmao ignore all of this. leaving up for posterity. no issue with config. github's copilot API was just down/degraded last night


Going to continue debugging, just wanted to log what I'm seeing so far. Was working for me for until today

copilot.vim

screenshots Screen Shot 2022-11-24 at 7 23 12 PM Screen Shot 2022-11-24 at 7 22 41 PM Screen Shot 2022-11-24 at 7 16 31 PM Screen Shot 2022-11-24 at 7 24 56 PM Screen Shot 2022-11-24 at 7 25 19 PM Screen Shot 2022-11-24 at 7 42 28 PM Screen Shot 2022-11-24 at 7 42 25 PM Screen Shot 2022-11-24 at 7 49 01 PM

Re-authorizing on account with active Copilot access:

Screen Shot 2022-11-24 at 7 56 02 PM

Re-starting lvim, unauthorized again:

Screen Shot 2022-11-24 at 7 56 36 PM

copilot-cmp

enable prada & reload config ->

[copilot] config is already set
Error executing vim.schedule lua callback: .../site/pack/packer/opt/copilot.lua/lua/copilot/client.lua:47: attempt to index local 'params' (a nil value)
stack traceback:
        .../site/pack/packer/opt/copilot.lua/lua/copilot/client.lua:47: in function 'merge_server_opts'
        .../site/pack/packer/opt/copilot.lua/lua/copilot/client.lua:75: in function 'start'
        ...im/site/pack/packer/opt/copilot.lua/lua/copilot/init.lua:37: in function <...im/site/pack/packer/opt/copilot.lua/lua/copilot/init.lua:36>
Screen Shot 2022-11-24 at 7 29 48 PM
luxus commented 1 year ago

copilot.vim works fine, cannot reproduce

after some modifications I got even cmp working.

luxus commented 1 year ago

cmp variant is not stable or working correctly for me. does anyone else have luck with it?

luxus commented 1 year ago

shrug