Closed cuonglm closed 8 years ago
Hi, thanks for the issue report, sorry it's taken a while to get back to you.
I have to say I'm not exactly clear on what the problem is. Completion does not (by default anyway) use the TAB key. So when you type #include <
you should not expect completion to start, at least not with the default company settings.
I just tried to replicate the problem using the default setting for company-c-headers-path-system
, which as you note includes /usr/include
. In a new c++-mode buffer I typed #include <x86
, and it instantly filled in the remaining x86_64-linux-gnu
. This is because I am using the default company settings which will start the completion after typing 3 characters.
I also tried it by just typing #include <
, and it successfully found all of the files and subdirectories within /usr/include
after invoking M-x company-complete
.
So I guess in summary I'm having trouble replicating your problem. Please let me know if there's something I'm missing.
@randomphrase Thanks for response.
I mean at this time, there is no way to complete:
#include <sys/types.h>
by typing:
#include <sys/[call company completion here]>
You have to:
#include <x86_64-linux-gnu/[call company completion here]>
or:
#include <x86_64-linux-gnu/sys/[call company completion here]>
I use gcc
and clang
and both compilers accept explicit include x86_64-linux-gnu/sys/types.h
or implicit sys/types.h
. Is there any way for company-c-headers
act like that?
OK so in this case the sys/types.h
path relies on the compiler's built-in system include paths. In other words, you don't have to specify /usr/include/x86_64-linux-gnu
to the compiler because it knows about that path already. If you do gcc -v -E -
you will see all of the built-in include paths for gcc. Other compilers will have other built-in include paths.
From the perspective of company-c-headers there's no way to know which compiler you are using, let alone the built-in include paths for that compiler. This is exactly why this is a customizable variable - so that it can be customized for your specific application.
Personally I rely on EDE to get this information - as described in the doco. If you aren't using EDE then you'll have to find another way to do it.
@randomphrase Well, that's exactly what I said in the question:
Adding `/usr/include/x86_64-linux-gnu/` to company-c-headers-path-system can fixed the issue. But there're many sub-directories inside `/usr/include`. Manually adding those directories cause a lot of works.
Is there anyway for `company-c-headers` automatically look in sub-directories?
The keyword is automatically
.
It's better if I described this problem as a feature request.
Thanks for your information.
A Simple header file like:
can not be completed with:
I have to use:
Adding
/usr/include/x86_64-linux-gnu/
tocompany-c-headers-path-system
can fixed the issue. But there're many sub-directories inside/usr/include
. Manually adding those directories cause a lot of works.Is there anyway for
company-c-headers
automatically look in sub-directories?