randomphrase / company-c-headers

Auto-completion for C/C++ headers using Company
GNU General Public License v2.0
76 stars 9 forks source link

compatibility #4

Closed silgon closed 8 years ago

silgon commented 10 years ago

I have a little question with compatibility. When I install https://github.com/Sarcasm/company-irony, the completion in company-c-headers stops working. Nonetheless, when I do M-x company-c-headers when I'm after #include < the completion works, but it doesn't work automatically, and the command M-x company-search-mode answers me no completions found. Have you any idea why this is happening? The important file of my init.el file is

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

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

(require 'company-irony)
(require 'company-c-headers)

(add-to-list 'company-backends 'company-c-headers)
(add-to-list 'company-backends 'company-irony)

Another question. With irony-mode you have a .clang_complete file which you can load for completions with the command irony-cdb-menu and this shows you the .clang_complete file in your closes parent directory to load. Is there any way to do also this with company-c-headers? The clang is like this:

-I/opt/ros/hydro/include
-I/usr/include/eigen3/
randomphrase commented 9 years ago

Firstly: I don't use irony mode so I can't really help you. One thing to try is to put both the company-c-headers and company-irony backends into a list before adding to the backends. e.g. (add-to-list 'company-backends (list company-c-headers company-irony)).

Secondly: Can you read the current include directories out of irony mode? If so you can just create a function to access them, and bind to it, e.g. (setq company-c-headers-path-system 'irony-mode-get-system-headers).