Exafunction / codeium.vim

Free, ultrafast Copilot alternative for Vim and Neovim
https://codeium.com
MIT License
4.13k stars 147 forks source link

Accumulation of leftover binaries #200

Open chrisgrieser opened 1 year ago

chrisgrieser commented 1 year ago

It appears with every update of codeium.vim, there is one more binary here. My guess is that the plugin does not remove the outdated binaries?

Pasted image 2023-08-06 at 10 25 52@2x
pqn commented 1 year ago

Yes, the reason we don't do so by default is that there may be multiple IDEs for Codeium which are not updated in sync, so it's hard to know which versions are still needed. Open to adding a setting to delete the old versions.

chrisgrieser commented 1 year ago

I see. Yeah, an option sounds good!

chrisgrieser commented 11 months ago

ok, so since the directory accumulated a total of 3gb for me by now, I hacked together a small temporary solution. Posting this here in case anyone finds this via search.

Using the build spec from lazy.nvim, this deletes all but the up-to-date binary from the system, on every update of the plugin.

{
    "Exafunction/codeium.vim",
    build = function()
        local bin_path = os.getenv("HOME") .. "/.codeium/bin"
        local oldBinaries =
            vim.fs.find("language_server_macos_arm", { limit = math.huge, path = bin_path })
        table.remove(oldBinaries) -- remove last item (= most up to date binary) from list
        for _, binaryPath in pairs(oldBinaries) do
            os.remove(binaryPath)
            os.remove(vim.fs.dirname(binaryPath))
        end
    end,
},