codeium.vim icon indicating copy to clipboard operation
codeium.vim copied to clipboard

Accumulation of leftover binaries

Open chrisgrieser opened this issue 2 years ago • 3 comments

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

chrisgrieser avatar Aug 06 '23 08:08 chrisgrieser

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.

pqn avatar Aug 08 '23 00:08 pqn

I see. Yeah, an option sounds good!

chrisgrieser avatar Aug 08 '23 03:08 chrisgrieser

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,
},

chrisgrieser avatar Oct 28 '23 14:10 chrisgrieser