Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
906 stars 99 forks source link

Can not complete with company on OSX #327

Open Icarus0xff opened 8 years ago

Icarus0xff commented 8 years ago

Hi, I have a problem to set up irony-mode for company. My system is OSX, and my .emacs configuration is as followed:

;;irony-mode
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)

;; replace the `completion-at-point' and `complete-symbol' bindings in
;; irony-mode's buffers by irony-mode's asynchronous function
(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)

;;company-irony
(eval-after-load 'company
  '(add-to-list 'company-backends 'company-irony))

But completion-at-point and irony-completion-at-point-async can't work. And I try to run irony-server manually it looks good.

Sarcasm commented 8 years ago

Do you have a compilation database to indicate the compile options?

Does it work with a trivial example that does not contain any #include?

struct Foo
{
   int foobar;
   int barbaz;
};

void f(const Foo& foo) {
  foo.[TAB]
}
agauniyal commented 8 years ago

@Sarcasm is it possible to provide a fallback compile options, probably through .clangcomplete file in $HOME directory?

Sarcasm commented 8 years ago

@Sarcasm is it possible to provide a fallback compile options, probably through .clangcomplete file in $HOME directory?

Yes it's possible.