Exafunction / codeium.vim

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

bug: commit `decfb54` breaks codeium.vim in nvim #376

Closed cleong14 closed 3 months ago

cleong14 commented 3 months ago

(Issue & temporary workaround discovered by @Wordluc)

Confirmed that decfb54 [1.8.49] breaks codeium.vim in nvim.

Also, confirmed that rolling back to 289eb72 [1.8.37] fixes codeium.vim in nvim and restores normal functionality.

fortenforge commented 3 months ago

Do you have any errors?

cleong14 commented 3 months ago

I haven't seen any.

Is there a way for me to generate debug output and/or a log file? E.g. Similar to codeium.nvim's DEBUG_CODEIUM environment variable and ~/.cache/nvim/codeium.log file?

Wordluc commented 3 months ago

Do you have any errors?

No, anything, even the chat doesn't works

nexxai commented 3 months ago

Can also confirm that by reverting to commit 289eb724e5d6fab2263e94a1ad6e54afebefafb2 and also completely deleting and reinstalling codeium.vim and codeium.nvim from LazyVim using the following config, everything started working for me again too.

return {
  {
    "Exafunction/codeium.vim",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "hrsh7th/nvim-cmp",
    },
    commit = "289eb724e5d6fab2263e94a1ad6e54afebefafb2",
    event = "BufEnter",
    config = function()
      vim.keymap.set("i", "<C-Space>", function()
        return vim.fn["codeium#Accept"]()
      end, { expr = true, silent = true })
    end,
  },
}
angelinuxx commented 3 months ago

I experienced the same issue, for me Codeium seems to work, but the status in the status line remains stuck on '*' - waiting for Codeium response.

After downgrading to commit 289eb724e5d6fab2263e94a1ad6e54afebefafb2, everything started working again for me too.

LeonardoMor commented 3 months ago

After making sure it is loaded, you can :CodeiumToggle twice. Then it'll start working. I have no idea why this is happening.

LeonardoMor commented 3 months ago

After making sure it is loaded, you can :CodeiumToggle twice. Then it'll start working. I have no idea why this is happening.

Correction, :CodeiumEnable is enough

nexxai commented 3 months ago

After making sure it is loaded, you can :CodeiumToggle twice. Then it'll start working. I have no idea why this is happening.

Correction, :CodeiumEnable is enough

For the record, neither of these options worked for me

academo commented 3 months ago

The problem is in the language server which is exiting with error before the plugin can start it.

if helps in anyway this is the error in my system:

I0610 12:54:34.972900 34372 main.go:552] Starting language server process with pid 34372
I0610 12:54:34.972948 34372 server.go:154] Language server will attempt to listen on host 127.0.0.1
I0610 12:54:34.973022 34372 server.go:161] Language server listening on random port at 39549
I0610 12:54:34.973062 34372 proxy.go:113] proxyplease.proxy> No proxy provided. Attempting to infer from system.
I0610 12:54:34.973074 34372 proxy.go:113] proxyplease.proxy> No proxy could be determined. Assuming a direct connection.
I0610 12:54:34.973085 34372 client.go:589] [DEBUG] GET https://server.codeium.com/exa.api_server_pb.ApiServerService/GetCompletions
I0610 12:54:35.365469 34372 unleash.go:90] Initializing Unleash
I0610 12:54:35.760460 34372 unleash.go:110] Successfully initialized Unleash
E0610 12:54:35.768227 34372 client_manager.go:270] Metadata is nil when trying to refresh user JWT
I0610 12:54:36.161765 34372 server.go:353] Successfully created API server client
I0610 12:54:36.185848 34372 server.go:362] Successfully initialized tokenizer
I0610 12:54:36.233443 34372 server.go:461] Local search is enabled, will index local files.
I0610 12:54:36.233467 34372 server.go:465] Using 5 indexer workers
I0610 12:54:36.233497 34372 search_provider.go:193] Using database at /home/academo/.codeium/database/default/2/MODEL_EMBED_6591
I0610 12:54:36.234300 34372 database.go:127] Bad db state detected: false
I0610 12:54:36.234459 34372 search_provider.go:206] Successfully created embedding search database in 0ms
I0610 12:54:36.234761 34372 search_provider.go:228] Successfully created and started indexer
I0610 12:54:36.234779 34372 search_provider.go:254] Successfully created embedding search provider
I0610 12:54:36.234785 34372 server.go:500] Successfully created exact search provider
F0610 12:54:36.235506 34372 main.go:555] Language server failed - read /home/academo/.config/nvim/: is a directory
(1) attached stack trace
  -- stack trace:
  | github.com/Exafunction/Exafunction/exa/language_server.CreateLanguageServerAndServe
  |     exa/language_server/server.go:165
  | main.main
  |     exa/cmd/language_server/main.go:553
  | runtime.main
  |     GOROOT/src/runtime/proc.go:267
Wraps: (2) attached stack trace
  -- stack trace:
  | github.com/Exafunction/Exafunction/exa/language_server.initServers
  |     exa/language_server/server.go:526
  | github.com/Exafunction/Exafunction/exa/language_server.CreateLanguageServerAndServe
  |     exa/language_server/server.go:163
  | main.main
  |     exa/cmd/language_server/main.go:553
  | runtime.main
  |     GOROOT/src/runtime/proc.go:267
Wraps: (3) attached stack trace
  -- stack trace:
  | github.com/Exafunction/Exafunction/exa/language_server/code_tracker.NewCodeTrackerManager
  |     exa/language_server/code_tracker/code_tracker_manager.go:128
  | [...repeated from below...]
Wraps: (4) attached stack trace
  -- stack trace:
  | github.com/Exafunction/Exafunction/exa/language_server/code_tracker.(*CodeTrackerManager).initialize
  |     exa/language_server/code_tracker/code_tracker_manager.go:281
  | github.com/Exafunction/Exafunction/exa/language_server/code_tracker.NewCodeTrackerManager
  |     exa/language_server/code_tracker/code_tracker_manager.go:127
  | github.com/Exafunction/Exafunction/exa/language_server/completion_provider.NewSessionRouter
  |     exa/language_server/completion_provider/session_router.go:83
  | github.com/Exafunction/Exafunction/exa/language_server.initServers
  |     exa/language_server/server.go:518
  | github.com/Exafunction/Exafunction/exa/language_server.CreateLanguageServerAndServe
  |     exa/language_server/server.go:163
  | main.main
  |     exa/cmd/language_server/main.go:553
  | runtime.main
  |     GOROOT/src/runtime/proc.go:267
  | runtime.goexit
  |     src/runtime/asm_amd64.s:1650
Wraps: (5) read /home/academo/.config/nvim/
Wraps: (6) is a directory
Error types: (1) *withstack.withStack (2) *withstack.withStack (3) *withstack.withStack (4) *withstack.withStack (5) *fs.PathError (6) syscall.Errno
kamalkech commented 3 months ago

still not working even if with downground then auth then enable, codeium not working at all

kamalkech commented 3 months ago

@nexxai still not working for me

assafdori commented 3 months ago

I can confirm that downgrading to commit 289eb724e5d6fab2263e94a1ad6e54afebefafb2 and re-installing codeium.vim resolved this for now. Thanks @nexxai

pqn commented 3 months ago

Anyone encountering this issue should be able to delete ~/.codeium/code_tracker. We will work on an automatic fix.

nexxai commented 3 months ago

Anyone encountering this issue should be able to delete ~/.codeium/code_tracker. We will work on an automatic fix.

I can confirm that removing this folder and re-upgrading to the latest version works for me.

nexxai commented 3 months ago

@pqn looks like I spoke too soon. Something seems to be damaging the contents of that folder because after deleting it, the plugin worked for about 20 minutes then stopped again. Deleting it made it start working again, but that doesn't seem like a long term solution.

hkhrithik007 commented 3 months ago

yesterday i faced the same issue and still facing it after redoing auth the codeium works but after few minutes it stopps working

hkhrithik007 commented 3 months ago

did all the stuff like added commit thing and deleting thing works for for some time then it stops and codeium toggle, codeium enble both doesn’t work .

njiang747 commented 3 months ago

When seeing this issue reoccur, when does it occur? Is it on relaunching a neovim editor? Also are you modifying files in ~/.confing/nvim/?

LeonardoMor commented 3 months ago

Anyone encountering this issue should be able to delete ~/.codeium/code_tracker. We will work on an automatic fix.

I do not have this file.

njiang747 commented 3 months ago

Anyone encountering this issue should be able to delete ~/.codeium/code_tracker. We will work on an automatic fix.

I do not have this file.

What issues are you seeing? Did you get the same error log as @academo and @nexxai ?

LeonardoMor commented 3 months ago

Anyone encountering this issue should be able to delete ~/.codeium/code_tracker. We will work on an automatic fix.

I do not have this file.

What issues are you seeing? Did you get the same error log as @academo and @nexxai ?

Only that I have to manually enable Codeium for it to start working. Where do I see a Codeium log?

rsignavong commented 3 months ago

did all the stuff like added commit thing and deleting thing works for for some time then it stops and codeium toggle, codeium enble both doesn’t work .

I have the same behaviour, I did the following steps:

I want to check the logs but don't know where to find it.

njiang747 commented 3 months ago

To get logs you can add let g:codeium_log_file = '~/codeium.log' to your .vimrc file (you can of course direct the logs to whatever file you want).

daUnknownCoder commented 3 months ago

@pqn , ~/.codeium/code_tracker this folder has all the files i edited and where i used codeium, is it safe to remove this + why is it getting stored? like why am i sending the whole file to codeium? it isnt making sense

njiang747 commented 3 months ago

@pqn , ~/.codeium/code_tracker this folder has all the files i edited and where i used codeium, is it safe to remove this + why is it getting stored? like why am i sending the whole file to codeium? it isnt making sense

Yes you can remove this at any time (though we will continue to write to it). The files in this directory aren't being sent to Codeium servers they're just used by our extension locally. These are mostly used for our metrics so we can understand things like how much code we are writing vs. the user is writing (of course our goal is to be able to write more and more of the user's code to provide more value).

cleong14 commented 3 months ago

Update (2024-06-13):

Confirmed pinning to commit 289eb724e5d6fab2263e94a1ad6e54afebefafb2 is no longer necessary, updating to the latest commit does work, and any issues encountered (e.g. no suggestions provided or errors thrown on accept suggestion keymaps) is fixable with the workaround of removing the ~/.codeium/code_tracker directory (e.g. rm -rf ~/.codeium/code_tracker).

LeonardoMor commented 3 months ago

This is strange.

After the last update, Codeium was working for me on Vim but not on Neovim. I then added this to see what was going on:

vim.g.codeium_log_file = "~/.codeium/codeium.log"

Just by doing that, Codeium started working on Neovim. I'll keep an eye on this as others said it only works for some time.

LeonardoMor commented 3 months ago

This is strange.

After the last update, Codeium was working for me on Vim but not on Neovim. I then added this to see what was going on:

vim.g.codeium_log_file = "~/.codeium/codeium.log"

Just by doing that, Codeium started working on Neovim. I'll keep an eye on this as others said it only works for some time.

Yeah, just had to open a different file for it to not work anymore. Got this in the log:

Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Chat[5]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]

But it still works in vim. Here you can see the difference between the two editors:

asciicast

LeonardoMor commented 3 months ago

Here is a little update. With the latest tag in Neovim I have to :CodeiumToggle twice to get Codeium suggestions. Doing :CodeiumEnable no longer works.

And, it still works all the time with Vim.

VVoruganti commented 3 months ago

This is strange. After the last update, Codeium was working for me on Vim but not on Neovim. I then added this to see what was going on:

vim.g.codeium_log_file = "~/.codeium/codeium.log"

Just by doing that, Codeium started working on Neovim. I'll keep an eye on this as others said it only works for some time.

Yeah, just had to open a different file for it to not work anymore. Got this in the log:

Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Chat[5]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function codeium#Complete[58]..codeium#server#Request, line 2]

But it still works in vim. Here you can see the difference between the two editors:

asciicast

Seeing the same behaviour. running :CodeiumToggle twice did not fix the issue.

Log file looks like this

Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
Exception: Server port has not been properly initialized. [function <SNR>42_SendHeartbeat[2]..codeium#server#Request, line 2]
ecerulm commented 3 months ago
vim.g.codeium_log_file = "~/codeium.log"
vim.g.codeium_log_level = "DEBUG"

will provider more logs. In my particular case which I reported at https://github.com/Exafunction/codeium.vim/issues/393 the actual problem is that the language server fails to start with a read /xxx/yyy: is a directory, I'm not sure if this particular bug report is the same thing. But if you enable debug level you will get more specific error and you can report that specific error in another issue.

pqn commented 3 months ago

I've just released an update that should handle the code tracker issue (#395). Closing this for now, but can reopen if anyone finds it's still occurring (for other problems open a new issue).