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

Suggestion: Mention integration with Elpy in troubleshooting resources #59

Open
Firewolf34 opened this issue Aug 22, 2023 · 1 comment

Comments

@Firewolf34
Copy link

Firewolf34 commented Aug 22, 2023

Elpy.el is one of the premier Emacs extensions for Python, which a lot of new Python devs in Emacs may be using.

If they, like me, encountered an issue where /when Elpy is enabled, the Codeium.el company integration does not work/, they will need to prevent Elpy from removing their Codeium.el company-capf backend.

Cause: When Elpy is running, if it has it's "Company Module" enabled, this section of code will remove the company-capf backend to prevent "unwanted interference" with the elpy-company-backend:
https://github.com/jorgenschaefer/elpy/blob/7ff8ffa918411887d165764f7a5a12bc46646e73/elpy.el#L2820

To avoid this, one can add the company-capf backend back into their company-backends buffer-local-variable, in a python hook, at a high-priority (e.g. 99). This way, Elpy will remove the company-capf, but then the new hook will just add it back. And it will be at the front of the list, so that Codeium.el gets highest company backend priority (runs first). Though I think this will stop most of the elpy suggestions which may not be ideal.

Using the example from the Readme.md of this project:

;; 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))
;; <---------- Begin modified section ------------>
               (setq-local company-backends (cons 'company-capf company-backends))) ;;Add capf to front of company-backends list
              99) ;;set the priority to highest.

I hope this helps anyone who may have this issue!

I understand that you can use cape as well and that may be a better solution.

My suggestion is to add a note to this README.md that specifies that this may happen to avoid troubleshooting confusion. Thanks for the awesome emacs extension, Codeium developers!

@Firewolf34
Copy link
Author

Is the only way to get Codeium and Elpy backends to run simultaneously (currently) to use cape?

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

1 participant