Exafunction / codeium.vim

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

codeium attempts to make the codeium folder in the root directory #319

Open beastr45 opened 4 months ago

beastr45 commented 4 months ago

I would review your code for setup as codium displays an error message indicating it is attempting to write the codeium folder into the root directory even though my XDG home is set.

I havent looked at the codebase myself but the error is in this function:

Error detected while processing function codeium#server#Start[51]..39_ActuallyStart:
line 3:
E739: Cannot create directory /codeium: permission denied

drjmcauliffe commented 3 months ago

I had something similar on Windows 10 with Neovim in Windows Terminal:

Error detected while processing function codeium#server#Start:
line   28:
E739: Cannot create directory Z:\/.codeium: no such file or directory
Press ENTER or type command to continue

I have no Z: drive on my machine... my investigation led me to codeium.vim/autoload/codeium/command.vim:

function! codeium#command#HomeDir() abort
  let data_dir = $XDG_DATA_HOME
  if empty(data_dir)
    let data_dir = $HOME . '/.codeium'
  else
    let data_dir = data_dir . '/.codeium'
  endif
  return data_dir
endfunction

I eventually got this to work by creating an XDG_DATA_HOME environment variable that pointed to %USERPROFILE%\AppData\Local.

However, I then get 2 .codeium folders, one in the user folder:

image

and one in the AppData\Local folder:

image

as opposed to 1 on linux:

image

... and on Windows ever time I start Neovim, codeium updates:

image

In any case, it works now... but took a bit of time to get there.

pqn commented 3 months ago

@nicholasmoy we could make the database respect $XDG_DATA_HOME as well