Sarcasm / company-irony

company-mode completion back-end for irony-mode
119 stars 11 forks source link

Can not work with company-c-headers #36

Closed yuzumx closed 7 years ago

yuzumx commented 7 years ago

When I use company-irony and company-c-headers at the same time, company-c-headers does not automatically trigger.

Value of company-backends :

Value: (company-c-headers company-irony
                   (company-capf company-dabbrev-code)
                   company-dabbrev)

My configuration:


(when (maybe-require-package 'company-c-headers)
  (after-load 'company
    (add-hook 'c-mode-common-hook
              (lambda () (sanityinc/local-push-company-backend 'company-c-headers)))))

;;; Use irony-mode to support auto-complete
(unless *is-macOS*
  (when (maybe-require-package 'irony)
    (add-hook 'c-mode-hook 'irony-mode)
    (add-hook 'c++-mode-hook 'irony-mode)
    (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)))

(after-load 'irony
  (diminish 'irony-mode))

(when (package-installed-p 'irony)
  (when (maybe-require-package 'company-irony)
    (after-load 'company
      (add-hook 'c-mode-common-hook
                (lambda () (sanityinc/local-push-company-backend 'company-irony))))))

code of sanityinc/local-push-company-backend :

(defun sanityinc/local-push-company-backend (backend)
    "Add BACKEND to a buffer-local version of `company-backends'."
    (set (make-local-variable 'company-backends)
         (append (list backend) company-backends))))

When I disable irony-mode, the company-c-headers takes effect.

Thank you.

yuzumx commented 7 years ago

Sorry it's my bad.