I'm trying to add a header files path to company-mode but I can't do it. I did it with flycheck as follow:
(defun include-paths ()
(setq flycheck-clang-include-path (list (expand-file-name "../include"))))
(add-hook 'c++-mode-hook 'include-paths)
Is there a similar way to do it with company-mode?
I'm assuming you're using company-c-headers.
Almost verbatim from their README file, you can use M-x customize-groups
, company-c-headers
to modify the search directories.
Alternatively, you can bind the company-c-headers-path-system and company-c-headers-path-user variables to functions which return the corresponding paths. For example, if you are using EDE, you can use the following:
(defun ede-object-system-include-path ()
"Return the system include path for the current buffer."
(when ede-object
(ede-system-include-path ede-object)))
(setq company-c-headers-path-system 'ede-object-system-include-path)
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With