Exafunction / codeium.nvim

A native neovim extension for Codeium
MIT License
762 stars 57 forks source link

Suggestions form Codeium won't show in cmp #65

Closed coder9194 closed 12 months ago

coder9194 commented 1 year ago

My current setup works great on my Mac Mini, but doesn't work on my Windows laptop. :( I'm using the latest Neovim 0.9.1 with Lazyvim, and this package at ed7bae74 commit.

codeium.lua

{
  "jcdickinson/codeium.nvim",
  dependencies = {
    "nvim-lua/plenary.nvim",
    "hrsh7th/nvim-cmp",
  },
  config = function()
    require("codeium").setup()
  end,
}

nvim-cmp.lua

{
"hrsh7th/nvim-cmp",
  dependencies = { "onsails/lspkind.nvim" },
  opts = {
    sources = require("cmp").config.sources({
      { name = "buffer", max_item_count = 2 },
      { name = "codeium", max_item_count = 2 },
      { name = "cmp_tabnine", max_item_count = 2 },
      { name = "nvim_lsp" },
      { name = "luasnip" },
      { name = "path" },
    }),
    mapping = require("cmp").mapping.preset.insert({
      ["<C-a>"] = require("cmp").mapping.complete(),
    }),
    formatting = {
      format = function(entry, vim_item)
        -- if you have lspkind installed, you can use it like
        -- in the following line:
        vim_item.kind = require("lspkind").symbolic(vim_item.kind, { mode = "symbol_text" })
        vim_item.menu = source_mapping[entry.source.name]

        if entry.source.name == "codeium" then
          local detail = (entry.completion_item.data or {}).detail
          vim_item.kind = " Codeium"
          if detail and detail:find(".*%%.*") then
            vim_item.kind = vim_item.kind .. " " .. detail
          end

          if (entry.completion_item.data or {}).multiline then
            vim_item.kind = vim_item.kind .. " " .. "[ML]"
          end
        end
        local maxwidth = 80
        vim_item.abbr = string.sub(vim_item.abbr, 1, maxwidth)
        return vim_item
      end,
    },
  },
}
WillEhrendreich commented 1 year ago

ok, so does your windows machine have Gzip installed? if so, are you able to invoke it via powershell or cmd, I.E. is it on your PATH environment variable?

I made a pr a while ago that should have fixed it so you don't have to use gzip on windows.. I'm pretty sure I was wrong lol. I'm still trying to figure it out as I have free time, but it's very likely that you're going to need gzip.

uuidgen is not needed for sure on windows, I wrote a pr with a func a while ago that just makes a uuid, no external dependency needed there.

something important to do is to create/set your an environment variable called DEBUG_CODEIUM to 'debug' or even 'trace'.

this will start spitting out log info as to what's going on with the plugin, and it will likely be found somewhere like C:/temp/neovim/codeium.log or C:/temp/neovim/codeium/codeium.log.. something like that.

you should see what's going wrong there, after you've collected some data.

let me know what your log says, I'll try to get you up an running, but just so you know I can't merge anything to this repo, I don't have permissions or anything, so if a fix is needed, the best I can do is make a pr, and hope someone will merge it.

BenSolus commented 1 year ago

Facing a similar issue I can provide a codeium.log (rust - writing 'println!("Hello World)'). It seems to generate suggestions with success but none of those appear in cmp's suggestions. Though I don't see any error messages it seems to complain about absolutePath and relativePath at the start.

Using Linux and LazyVim with nvim being

nvim --version
NVIM v0.10.0-dev-692+g86ce3878d
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

I have installed uname, uuidgen, curl and gzip (and having them in my PATH) and, if I understand the log, the language server seems to work.

My (LazyVim) cmp/codeium (b36eaad) configuration looks as follows:

return {
  "hrsh7th/nvim-cmp",
  dependencies = {
    -- ...
    {
      "jcdickinson/codeium.nvim",
      dependencies = {
        "nvim-lua/plenary.nvim",
        "hrsh7th/nvim-cmp",
      },
      config = function(_, opts)
        require("codeium").setup(opts)
      end,
    },
  },
  opts = function(_, opts)
    local cmp = require("cmp")
    -- ...
    opts.sources = cmp.config.sources(vim.list_extend(opts.sources, { { name = "codeium", group_index = 2 } }))
    -- ...
  end,
}

CmpStatus lists codeium as one of 'ready source names'. Suggestions of other source names (for example rust_anaylzer) appear.

Any more information required?

gugahoi commented 1 year ago

Seems like there is an issue with nvim-cmp and Codeium as per the comment here

Pinning cmp to the referenced commit makes Codeium completions work, for example:

{
  "hrsh7th/nvim-cmp",
  commit = "6c84bc75c64f778e9f1dcb798ed41c7fcb93b639",
  dependencies = { "hrsh7th/cmp-cmdline", "hrsh7th/cmp-nvim-lsp-signature-help" },
}
cleong14 commented 1 year ago

Confirming #84 fixed this issue for me.

pqn commented 12 months ago

Given #84 and #88, feels like this can be closed.