1
0
mirror of https://github.com/jojojames/evil-collection.git synced 2024-06-26 07:29:01 +02:00

fix: Stop inhibiting company popup when not in evil-mode

Evil-collection package inhibits company from showing completions when evil-mode
is switched off. This commit will fix it and only activate evil-collection
advice for company-mode when in evil-mode.

If applied, this commit will:
    * Allow `company-mode` to show completions when not in `evil-mode`.
    * Only activate `evil-collection` advice for `company-mode` when in
    `evil-mode`.
    * Fixes #451.
This commit is contained in:
randy1burrell 2021-01-27 17:53:50 -05:00 committed by James N
parent bd44a32e83
commit 7a4f8085f3

View File

@ -62,9 +62,13 @@ be set through custom or before evil-collection loads."
(defun evil-collection-company-supported-p (command &rest _) (defun evil-collection-company-supported-p (command &rest _)
"Return non-nil if `evil-state' is in supported states." "Return non-nil if `evil-state' is in supported states."
(cond (cond
((eq command 'prefix) ((eq command 'prefix)
(memq evil-state evil-collection-company-supported-states)) (memq evil-state evil-collection-company-supported-states))
(t t))) (t t)))
(defun evil-collection-company-popup ()
"When `evil-mode' is active, make `company-mode' not show popup if not in supported state."
(advice-add 'company-call-backend :before-while 'evil-collection-company-supported-p))
;;;###autoload ;;;###autoload
(defun evil-collection-company-setup () (defun evil-collection-company-setup ()
@ -98,7 +102,8 @@ be set through custom or before evil-collection loads."
(company-tng-configure-default))) (company-tng-configure-default)))
;; Make `company-mode' not show popup when not in supported state ;; Make `company-mode' not show popup when not in supported state
(advice-add 'company-call-backend :before-while 'evil-collection-company-supported-p)) (add-hook 'evil-mode-hook 'evil-collection-company-popup))
(provide 'evil-collection-company) (provide 'evil-collection-company)
;;; evil-collection-company.el ends here ;;; evil-collection-company.el ends here