Exafunction / codeium.el

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

codeium not working #33

Open b40yd opened 1 year ago

b40yd commented 1 year ago

my config:

(use-package codeium
    :ensure nil
    :quelpa (codeium :fetcher github :repo "Exafunction/codeium.el")
    :init
    ;; use globally
    (add-to-list 'completion-at-point-functions #'codeium-completion-at-point)

    :config
    (setq use-dialog-box t ;; do not use popup boxes
          codeium-mode-line t)

    ;; 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))

M-x: codeium-install M-x: codeium-init

but it's not working.

fortenforge commented 1 year ago

Are you using a completion frontend or the default completion-at-point frontend?

b40yd commented 1 year ago

Are you using a completion frontend or the default completion-at-point frontend? my config:

(use-package company
:diminish
:bind (("C-M-i" . company-complete)
:map company-mode-map
("<backtab>" . company-yasnippet))
:hook (after-init . global-company-mode)
:init
(setq company-tooltip-align-annotations t
company-tooltip-limit 12
company-idle-delay 0
company-echo-delay (if (display-graphic-p) nil 0)
company-minimum-prefix-length 1
company-icon-margin 3
company-require-match nil
company-dabbrev-ignore-case nil
company-dabbrev-downcase nil
company-global-modes '(not erc-mode message-mode help-mode
gud-mode eshell-mode shell-mode)
company-backends '((company-capf :with company-yasnippet)
(company-dabbrev-code company-keywords company-files)
company-dabbrev)))
fortenforge commented 1 year ago

@Alan-Chen99 do you have any ideas?

VentGrey commented 9 months ago

Same issue here. After some experimentation I've noticed codeium fails to show completions when some other company completion backend is running, for example with eglot included in Emacs 29.1:

Without eglot running: image

With eglot running: image

lucaspeixotoac commented 6 months ago

There is no suggestion for me if eglot is enabled. Once I turn off eglot, the suggestions come to appear.

Any idea on how to solving this? I would love to test this package.

finalclass commented 3 months ago

Same problem here. Any help?

onsails commented 2 months ago

Same problem with config similar to @b40yd, in rust files with lsp-mode. Codeium completions work in comments section but for code there are only LSP completion.