Code Monkey home page Code Monkey logo

Comments (13)

mcg-cyber avatar mcg-cyber commented on June 23, 2024 3

It is not codeium bug or faulty , but it is related to codeium . Codeium gives brief instructions to work with company but not with Corfu and Cape . That would be really useful for people if they write into readme how to integrate as many folks use Corfu and Cape . Anyway, thank you so much!

from codeium.el.

jeff-phil avatar jeff-phil commented on June 23, 2024 2

Yepper, here you go...

If using corfu, I'd suggest also getting its sibling: cape.

This part matches above, if just wanted to run codeium by itself outside of completion functions. I.e. matches above. It's bound to C-c p c below.

(defun my/cape-codeium (&optional interactive)
  "Allow codeium capf to be run by itself"
  (interactive (list t))
  (when interactive
    ;; if also testing copilot, clear their overlay before showing capf popup
    (when (bound-and-true-p copilot-mode) (copilot-clear-overlay))
    (cape-interactive #'codeium-completion-at-point)))
(keymap-global-set "C-c p c" #'my/cape-codeium)

For full gory effect, this is my setup for corfu, cape and eglot...

This merges codeium, eglot, dabbrev, cape-line all together into one capf:

;; Turn on/off if want to use codeium completions
(defvar my/codeium-is-enabled t)

(defalias 'my/capf-eglot+et-al
  (cape-capf-super
   (cape-capf-silent
    (when (bound-and-true-p my/codeium-is-enabled)
      (cape-capf-properties #'codeium-completion-at-point
                            :annotation-function
                            #'(lambda (_) (propertize "  Codeium"
                                                      'face font-lock-comment-face))
                            :company-kind (lambda (_) 'magic))))
   (cape-capf-buster #'eglot-completion-at-point 'equal)
   (cape-capf-properties #'cape-dabbrev
                         :annotation-function
                         #'(lambda (_) (propertize " Dabbrev"
                                                   'face font-lock-comment-face)))
   ;; if line gets too chatty
   (cape-capf-silent
    (cape-capf-properties #'cape-line
                          :annotation-function
                          #'(lambda (_) (propertize " Line"
                                                    'face font-lock-comment-face))))))

;; eglot, just to validate with just eglot
(defun my/cape-eglot(&optional interactive)
  (interactive (list t))
  (when interactive
    ;; if also testing copilot, clear their overlay before showing capf popup
    (when (bound-and-true-p copilot-mode) (copilot-clear-overlay))
    (cape-capf-buster (cape-interactive #'eglot-completion-at-point) 'equal)))
(keymap-set eglot-mode-map "C-c p g" #'my/cape-eglot)

;; Since merging eglot and others, assign a key binding to test
;; can remove if feel good
(defun my/cape-eglot+et-al(&optional interactive)
  (interactive (list t))
  (when interactive
    ;; if also testing copilot, clear their overlay before showing capf popup
    (when (bound-and-true-p copilot-mode) (copilot-clear-overlay))
    (cape-interactive #'my/capf-eglot+et-al)))
(keymap-set eglot-mode-map "C-c p z" #'my/cape-eglot+et-al)

(defun my/eglot-capf-config()
  (setq-local completion-category-overrides '((file (styles partial-completion)))
              completion-category-defaults nil
              completion-styles '(orderless partial-completion basic)
              ;; add in file first, capf will know when in file mode
              completion-at-point-functions (list #'cape-file #'my/capf-eglot+et-al)))

(add-hook 'eglot-managed-mode-hook #'my/eglot-capf-config)

You can do about the same for elisp, lsp-mode, org-mode, etc. different mode completions. I'll leave that up to you.

Also, cape has a bunch of other completions, like tempel, keywords, emoji's, etc. that could also be combined in like above.

from codeium.el.

jeff-phil avatar jeff-phil commented on June 23, 2024 1

@gg-mmill

(for some reason, a local override of completion-at-point-functions does not seem to work:

Should work... here's fixed version:

(defun complete-codeium-bis ()
  (interactive)         ; Specify is command.
  (let ((completion-at-point-functions #'codeium-completion-at-point))
    (call-interactively 'company-complete)))

You had (call-interactively 'company-complete) still in the let binding vs in the body.

from codeium.el.

jeff-phil avatar jeff-phil commented on June 23, 2024 1

Since nothing to do with Codeium, you should probably start by looking at Corfu's repo for info and help, googling, etc. 🙂

With that said, I believe what you are looking for is corfu-candidate-overlay:
https://code.bsdgeek.org/adam/corfu-candidate-overlay

from codeium.el.

clintlombard avatar clintlombard commented on June 23, 2024

Seeing the same in Doom Emacs. I suspect this isn't working with a language server that's running.

from codeium.el.

gg-mmill avatar gg-mmill commented on June 23, 2024
(defun complete-codeium ()
  "Codeium." ; Doc string.
  (interactive)         ; Specify is command.
  (setq completion-at-point-bkp completion-at-point-functions)
  (setq completion-at-point-functions '(codeium-completion-at-point t))
  (call-interactively 'company-complete)
  (setq completion-at-point-functions completion-at-point-bkp)
)

Having the same issue, it seems that configuration to add codeium completion to completion-at-point-functions does not work well - furthermore, I don't want to call codeium for each completion.

Here's a (probably very hacky) function to perform explicit codeium completion (my first elisp interactive function !)
You can then bind the function to specific key e.g. (global-set-key (kbd "s-n") 'complete-codeium)

(for some reason, a local override of completion-at-point-functions does not seem to work:

(defun complete-codeium-bis ()
  "Codeium - this does not work ??"
  (interactive)         ; Specify is command.

  (let (
        (completion-at-point-functions '(codeium-completion-at-point t)
        )
        (call-interactively 'company-complete)
        )
  )
  )

from codeium.el.

mcg-cyber avatar mcg-cyber commented on June 23, 2024

I moved to Corfu from company. Any idea how we can use it with Corfu? Thank you for your suggestions!

from codeium.el.

mcg-cyber avatar mcg-cyber commented on June 23, 2024

Awesome! Yeah, actually my setup is with Corfu + Cape but not with Eglot. Thank you so much!

from codeium.el.

mcg-cyber avatar mcg-cyber commented on June 23, 2024

I just wanted to edit previous post whi is below as not disconnect from the subject.
When run codeium install, downloads arm version. I downloaded x64 manually and it seem that works. I need to add as well this line into init.el
(add-to-list 'completion-at-point-functuons #'codeium-completion-at-point) this solved the issue.
When run codeium init, it doesn't do anything. It supposed to launch the default browser and lead to codeium url. Another one is very slow somehow. I hope this report will help to other users if they face the similar issue. But thank you so much for help and suggestions!

Now that kind of error when run codeium init "Doing vfork: Exec format error: I have API key already in my config. No completions appear. No error in codeium diagnose. Just basic config as it's adviced in readme. I am confused.

from codeium.el.

jeff-phil avatar jeff-phil commented on June 23, 2024

Good-o, glad it's working. Probably should close this issue.

from codeium.el.

mcg-cyber avatar mcg-cyber commented on June 23, 2024

Hi, I reopened this as this is not a bug and related to my first question, Corfu, cape etc.
I would like to see the suggestions as inline not in the box. I disabled the view in box feature, now I don't see anything. I am aware of that I could do this with company-frontends variable (setq company-frontends '(company-pseudo-tooltip-unless-just-one-frontend company-preview-frontend).
How I can do that with Corfu, Cape, lsp-mode?
Could you help please? Thank you!

from codeium.el.

mcg-cyber avatar mcg-cyber commented on June 23, 2024

I close now. Thank you!

from codeium.el.

mcg-cyber avatar mcg-cyber commented on June 23, 2024

..

from codeium.el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.