Exafunction / codeium.nvim

A native neovim extension for Codeium
MIT License
644 stars 50 forks source link

Accumulating Codeium versions #58

Open chrisgrieser opened 1 year ago

chrisgrieser commented 1 year ago

Not sure whether this is an issue with this plugin or with codeium itself, but I noticed that the codium server binaries of previous versions are all kept, resulting in a bloated directory containing them: CleanShot 2023-05-15 at 10 23 20@2x

WillEhrendreich commented 1 year ago

From what I can tell, there's no reason not to delete all of them except the latest, perhaps the latest couple if you're nervous about something specifically.

It's not a bug of the plugin, per se, it's more just that it doesn't provide a mechanism of cleaning up old versions of the server. It wouldn't be exceedingly difficult to do, but the plugin author might consider it beyond the scope of what he intends to support, or just simply hasn't because he doesn't see it as much of a priority, or something like that.

If you'd like to contribute, this would be a good first issue to provide a solution for, I'd be surprised if they wouldn't accept the pull request. :)

chrisgrieser commented 1 year ago

yeah, I use this small code snippet in my build which does the job. can make a PR at some point, but skimming through the code base, I have yet to find the correct location for inserting it

{
    "jcdickinson/codeium.nvim",
    dependencies = { "nvim-lua/plenary.nvim", "hrsh7th/nvim-cmp" },
    build = function()
        local bin_path = vim.fn.stdpath("data") .. "/codeium"
        local oldBinaries = vim.fs.find(
            function() return true end,
            { type = "file", 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,
},