Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot see generated suggestion #34

Open
hegde-atri opened this issue May 18, 2023 · 8 comments
Open

Cannot see generated suggestion #34

hegde-atri opened this issue May 18, 2023 · 8 comments

Comments

@hegde-atri
Copy link

hegde-atri commented May 18, 2023

Configuration

Using Doom Emacs (latest version using doom upgrade) and Emacs 29.0.91
In packages.el: (package! codeium :recipe (:host github :repo Exafunction/codeium.el"))
In config.el:

;; we recommend using use-package to organize your init.el
(use-package codeium
    ;; if you use straight
    ;; :straight '(:type git :host github :repo "Exafunction/codeium.el")
    ;; otherwise, make sure that the codeium.el file is on load-path

    :init
    ;; use globally
    (add-to-list 'completion-at-point-functions #'codeium-completion-at-point)
    ;; or on a hook
    ;; (add-hook 'python-mode-hook
    ;;     (lambda ()
    ;;         (setq-local completion-at-point-functions '(codeium-completion-at-point))))

    ;; if you want multiple completion backends, use cape (https://github.com/minad/cape):
    ;; (add-hook 'python-mode-hook
    ;;     (lambda ()
    ;;         (setq-local completion-at-point-functions
    ;;             (list (cape-super-capf #'codeium-completion-at-point #'lsp-completion-at-point)))))
    ;; an async company-backend is coming soon!

    ;; codeium-completion-at-point is autoloaded, but you can
    ;; optionally set a timer, which might speed up things as the
    ;; codeium local language server takes ~0.2s to start up
    ;; (add-hook 'emacs-startup-hook
    ;;  (lambda () (run-with-timer 0.1 nil #'codeium-init)))

    ;; :defer t ;; lazy loading, if you want
    :config
    (setq use-dialog-box nil) ;; do not use popup boxes

    ;; if you don't want to use customize to save the api-key
    ;; (setq codeium/metadata/api_key "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")

    ;; get codeium status in the modeline
    (setq codeium-mode-line-enable
        (lambda (api) (not (memq api '(CancelRequest Heartbeat AcceptCompletion)))))
    (add-to-list 'mode-line-format '(:eval (car-safe codeium-mode-line)) t)
    ;; alternatively for a more extensive mode-line
    ;; (add-to-list 'mode-line-format '(-50 "" codeium-mode-line) t)

    ;; use M-x codeium-diagnose to see apis/fields that would be sent to the local language server
    (setq codeium-api-enabled
        (lambda (api)
            (memq api '(GetCompletions Heartbeat CancelRequest GetAuthToken RegisterUser auth-redirect AcceptCompletion))))
    ;; you can also set a config for a single buffer like this:
    ;; (add-hook 'python-mode-hook
    ;;     (lambda ()
    ;;         (setq-local codeium/editor_options/tab_size 4)))

    ;; You can overwrite all the codeium configs!
    ;; for example, we recommend limiting the string sent to codeium for better performance
    (defun my-codeium/document/text ()
        (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (min (+ (point) 1000) (point-max))))
    ;; if you change the text, you should also change the cursor_offset
    ;; warning: this is measured by UTF-8 encoded bytes
    (defun my-codeium/document/cursor_offset ()
        (codeium-utf8-byte-length
            (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (point))))
    (setq codeium/document/text 'my-codeium/document/text)
    (setq codeium/document/cursor_offset 'my-codeium/document/cursor_offset))

Trying this out, the completion system does something, but I cannot accept it the completion nor can I view it. It only appears in normal mode (nothing during insert mode).
image

I have tried quite a few keybinds to try and accept the suggestions. Any tips or feedback on anything I did wrong?

@hegde-atri hegde-atri changed the title Codeium doesn't work Cannot see generated suggestion May 18, 2023
@alcestide
Copy link

Experiencing the same problem mentioned above.
I'm using DoomEmacs too, so I suspect (?) it could potentially be framework-related.
No completion showed whatsoever, except sometimes when inside Normal Mode, as @hegde-atri already mentioned.
I'd love to use Codeium on Emacs too, as it already works flawlessly on my nvim configuration.

@strobe
Copy link

strobe commented Jul 16, 2023

got similar issue but probably different

found this in codeium-log

https://github.com/Exafunction/codeium/releases/download/language-server-v1.2.52/language_server_linux_arm.gz 6.01 secs status: 200
/nix/store/cs6ps5m9b7sk4bf8wbihwaqm8xyscis3-emacs-28.2/bin/emacs: /home/<username>/.cache/doom/codeium/codeium_language_server: No such file or directory

Process codeium exited abnormally with code 127

then, also tried to launch app manually

> . /home/<username>/.cache/doom/codeium/codeium_language_server
fish: Job 1, '/home/<username>/.cache/doom/codei…' terminated by signal SIGSEGV (Address boundary error)

(Vmware VM on M1 with NixOS 23.05)

@fortenforge
Copy link
Contributor

@strobe we don't support NixOS directly, but you can try something like what's mentioned in this PR: Exafunction/codeium.vim#149

@iris-garcia
Copy link

Anyone got this working with doom emacs?

@patrixr
Copy link

patrixr commented Oct 11, 2023

I have found that it doesn't work when I have eglot enabled. When I turn it off it works as expected, trying to get both to work together.

@spl3g
Copy link

spl3g commented Oct 11, 2023

@fortenforge so how do you add anything to the default command?
I have the same issue on NixOS, and steam-run fixes the SIGSEGV error.

@fortenforge
Copy link
Contributor

https://github.com/Exafunction/codeium.el/blob/main/codeium.el#L371

you probably want to modify this line to add "steam-run"

@spl3g
Copy link

spl3g commented Oct 11, 2023

I added "steam-run" at the 4th line and it worked, thanks

(codeium-def codeium-command (api state)
	(unless (codeium-state-manager-directory state)
		(setf (codeium-state-manager-directory state) (make-temp-file "codeium_" t)))
	`("steam-run",(codeium-get-config 'codeium-command-executable api state) ;; here
		 "--api_server_url" ,(codeium-get-config 'codeium-api-url api state)
		 "--manager_dir" ,(codeium-state-manager-directory state)
         "--register_user_url" ,(codeium-get-config 'codeium-register-user-url api state)
         ,@(if (codeium-get-config 'codeium-enterprise api state) '("--enterprise_mode"))
         "--portal_url" ,(codeium-get-config 'codeium-portal-url api state)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants