Exafunction / codeium.el

Free, ultrafast Copilot alternative for Emacs
https://www.codeium.com
MIT License
412 stars 13 forks source link

Doom Emacs installation doesn't work #28

Closed devcharmander closed 1 year ago

devcharmander commented 1 year ago

I've been struggling to get this running with the setup mentioned in the README.

I use Doom Emacs with Company.

Step 1

(package! codeium :recipe (:host github :repo "Exafunction/codeium.el"))

Added the above line in my packages.el

Step 2

Copy pasted the configuration present in the README

Step 3

Codeium-install -> entered key

Codeium logs

I0414 14:55:36.426776 76025 main.go:357] Starting language server manager with pid 76025
I0414 14:55:36.427200 76025 main.go:84] Manager acquired its lock file /var/folders/1l/5st2hg4d5sd9khj60jw4z7gr0000gp/T/codeium_pUPOXk/locks/manager.lock
I0414 14:55:36.428929 76025 main.go:199] Waiting for random port file in /var/folders/1l/5st2hg4d5sd9khj60jw4z7gr0000gp/T/codeium_pUPOXk/child_random_port_1681476936427253000_3120209764782295776 to be created
I0414 14:55:36.457829 76026 main.go:351] Starting language server process with pid 76026
I0414 14:55:36.470939 76026 proxy.go:42] proxyplease.proxy> No proxy provided. Attempting to infer from system.
2023/04/14 14:55:36 [proxy.Provider.readDarwinNetworkSettingProxy]: Automatic proxy is not enabled.
2023/04/14 14:55:36 [proxy.Provider.readDarwinNetworkSettingProxy]: https proxy is not enabled.
I0414 14:55:36.489102 76026 proxy.go:42] proxyplease.proxy> No proxy could be determined. Assuming a direct connection.
I0414 14:55:36.489130 76026 api_server_client.go:78] Successfully dialed proxy
I0414 14:55:36.489186 76026 server.go:244] Successfully created API server client
I0414 14:55:36.495830 76026 server.go:251] Successfully initialized tokenizer
I0414 14:55:36.495864 76026 server.go:258] Successfully created completion provider
I0414 14:55:36.495885 76026 server.go:356] Child process attempting to acquire lock file /var/folders/1l/5st2hg4d5sd9khj60jw4z7gr0000gp/T/codeium_pUPOXk/locks/child_lock_1681476936427326000_3231162659028036798
I0414 14:55:36.495909 76026 unleash.go:58] Initializing Unleash with production environment
I0414 14:55:36.496017 76026 server.go:366] Child process acquired lock file /var/folders/1l/5st2hg4d5sd9khj60jw4z7gr0000gp/T/codeium_pUPOXk/locks/child_lock_1681476936427326000_3231162659028036798
I0414 14:55:36.496214 76026 server.go:136] Language server will attempt to listen on host 127.0.0.1
I0414 14:55:36.496367 76026 server.go:172] Language server listening on random port at 56343
I0414 14:55:36.530251 76025 main.go:230] Language server manager found random port 56343
I0414 14:55:36.530276 76025 main.go:237] Language server manager attempting to connect to language server at 127.0.0.1:56343
I0414 14:55:36.543575 76025 main.go:118] Fixing language server port at 56343
I0414 14:55:36.543588 76025 main.go:283] Language server manager successfully connected to new language server at 127.0.0.1:56343
http://localhost:56343/exa.language_server_pb.LanguageServerService/Heartbeat 0.04 secs status: 200
I0414 14:55:36.904152 76026 unleash.go:73] Successfully initialized unleash
http://localhost:56343/exa.language_server_pb.LanguageServerService/Heartbeat 0.00 secs status: 200
https://github.com/Exafunction/codeium/releases/download/language-server-v1.1.60/language_server_macos_arm.gz 2.47 secs status: 200
http://localhost:56343/exa.language_server_pb.LanguageServerService/Heartbeat 0.00 secs status: 200
http://localhost:56343/exa.language_server_pb.LanguageServerService/Heartbeat 0.00 secs status: 200

Codeium Diagnose

codeium state: default
command: 
/Users/surya/.emacs.d/.local/cache/codeium/codeium_language_server --api_server_host server.codeium.com --api_server_port 443 --manager_dir /var/folders/1l/5st2hg4d5sd9khj60jw4z7gr0000gp/T/codeium_59agcQ

GetCompletions
http://localhost:57191/exa.language_server_pb.LanguageServerService/GetCompletions
codeium/metadata/ide_name   "emacs"
codeium/metadata/extension_version  "1.1.60"
codeium/metadata/ide_version    "28.2"
codeium/metadata/request_id 2
codeium/metadata/api_key    "232f6ce9-211d-40bb-ae8c-3d1a5528218c"
codeium/document/text   "I0414 14:55:36.426776 76025 main.go:357] Starting language server manager with pid 76025\nI0414 14:55..."
codeium/document/cursor_offset  0
codeium/document/editor_language    "special-mode"
codeium/document/language   0
codeium/document/line_ending    "\n"
codeium/editor_options/tab_size 4
codeium/editor_options/insert_spaces    t

Heartbeat
http://localhost:57191/exa.language_server_pb.LanguageServerService/Heartbeat
codeium/metadata/ide_name   "emacs"
codeium/metadata/extension_version  "1.1.60"
codeium/metadata/ide_version    "28.2"
codeium/metadata/request_id nil
codeium/metadata/api_key    "232f6ce9-211d-40bb-ae8c-3d1a5528218c"

CancelRequest
http://localhost:57191/exa.language_server_pb.LanguageServerService/CancelRequest
codeium/metadata/ide_name   "emacs"
codeium/metadata/extension_version  "1.1.60"
codeium/metadata/ide_version    "28.2"
codeium/metadata/request_id nil
codeium/request_id  nil
codeium/metadata/api_key    "232f6ce9-211d-40bb-ae8c-3d1a5528218c"

GetAuthToken
http://localhost:57191/exa.language_server_pb.LanguageServerService/GetAuthToken

RegisterUser
http://localhost:57191/exa.language_server_pb.LanguageServerService/RegisterUser
codeium/firebase_id_token   nil

auth-redirect
http://localhost:57191/auth

AcceptCompletion
http://localhost:57191/exa.language_server_pb.LanguageServerService/AcceptCompletion
codeium/metadata/ide_name   "emacs"
codeium/metadata/extension_version  "1.1.60"
codeium/metadata/ide_version    "28.2"
codeium/metadata/request_id nil
codeium/completion_id   nil
codeium/metadata/api_key    "232f6ce9-211d-40bb-ae8c-3d1a5528218c"

Expected result:

Start seeing suggestions as I type code.

Actual result:

side by side view of the code and the codeium-logs

Gifable-2023-04-14T17:14:37

devcharmander commented 1 year ago

Closing this issue as this seems like a duplicate of this https://github.com/Exafunction/codeium.el/issues/20

Will reopen otherwise :)

devcharmander commented 1 year ago

It worked!

Writing it here if someone stumbles up on this issue.

Since there were multiple backends, the value of the variable completion-at-point-functions should have codeium-completion-at-point on the top of the list.

The easy way to do it was to use cape which was also mentioned in the Readme file.

theherk commented 1 year ago

I'm really glad you found an easy solution, but would you mind documenting it a bit further for us in the back. I feel like I have tried several permutations, and haven't found the winning one yet.

I have turned off LSP, which works, but isn't ideal. I have enabled cape and used the hook as configured in this README with:

  (add-hook 'python-mode-hook
      (lambda ()
          (setq-local completion-at-point-functions
              (list (cape-super-capf #'codeium-completion-at-point #'lsp-completion-at-point)))))

Which somehow leaves lsp earlier in the completions-at-point-functions list. I attempted the add and remove functions in the linked issue, which seemed to work but seems a bit heavy handed since it will require quite a bit of configuration for each mode.

What I'd like is to have codeium at the head of all completions lists in some modes. But I'm failing to see how to force the issue.