0

I've been using Ivy Irony Company for some time and it works great on all libraries I included in my C++ program so far, but I've noticed Ivy rarely auto-completes my user defined classes, objects, variables and enumerations.

I've read about company having dabbrev backend for everything user defined in opened buffers. Also I've noticed that after I build my project with make company now displays my user defined enumerations, objects etc..

Is there a way to update dabbrev backend after each save and should I put dabbrev inside grouped backend for it to work?

As far as my init.el configuration, for autocompletion part I'm using config from https://github.com/dfrib/emacs_setup#cmake-idertags I've commented out rtags part:

(use-package irony
  :config
  (add-hook 'c-mode-hook 'irony-mode)
  (add-hook 'c++-mode-hook 'irony-mode)
  (add-hook 'objc-mode-hook 'irony-mode)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
  (defun my-irony-mode-hook ()
  (define-key irony-mode-map [remap completion-at-point]
    'irony-completion-at-point-async)
  (define-key irony-mode-map [remap complete-symbol]
    'irony-completion-at-point-async))
  (add-hook 'irony-mode-hook 'my-irony-mode-hook)
  (add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
  )

;; Company mode.
(use-package company
  :config (global-company-mode)
  )

;; company-irony.
(use-package company-irony
  :after company
  :config (global-company-mode)
  ;; (optional) adds CC special commands to `company-begin-commands' in order to
  (add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
  )

;; Company-mode backend for C/C++ header files that works with irony-mode.
;; Complementary to company-irony by offering completion suggestions to header files.
(use-package company-irony-c-headers
  :after company-irony
  :config
  ;; Load with `irony-mode` as a grouped backend
  (eval-after-load 'company
  '(add-to-list
    'company-backends '(company-irony-c-headers company-irony)))
  )

(use-package ivy
  :config
  (ivy-mode)
  (setq ivy-use-virtual-buffers t)
  (setq enable-recursive-minibuffers t)
``````````
  • It's a question about Irony, I think. But you should probably file a bug report. – Dmitry Jul 25 at 8:25
0

The dabbrev backend doesn't cache completions (so far), so you don't need to do anything for that. Except maybe start using it: your configuration snippet doesn't mention dabbrev even once.

Having said that, Irony, as a dedicated C/C++ completion backend, should provide much better results overall than dabbrev.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.