Sarcasm / company-irony

company-mode completion back-end for irony-mode
118 stars 11 forks source link

Why stop in command prefix if no match is found? #12

Closed hotpxl closed 9 years ago

hotpxl commented 9 years ago

For command prefix, I noticed that stop is returned when no match is found, causing subsequent backends to stop working. There are situations like #include "./ when I want another backend (like company-files) to work alongside to help completion. Is there any reason to stop all other backends?

Sarcasm commented 9 years ago

Please take a look at issue #7.

Let me know if that helps.

hotpxl commented 9 years ago

I think it makes sense to group company-irony with some others. Strangely YouCompleteMe has this feature of completing include files (-I compiler flags take effect). I wonder why irony doesn't do this, since both use clang as backend.

hotpxl commented 9 years ago

company-files and company-c-headers don't automatically read .clang_complete file and set search path. I expect irony-mode to have included this feature.

Sarcasm commented 9 years ago

It is planed, but this is not something that the libclang API helps with, so this has to be implemented in some other ways.

hotpxl commented 9 years ago

I think it's quite crucial and also doable. Do you have any timeline to finish it?

Sarcasm commented 9 years ago

I have no timeline but I welcome contributions. :)

hotpxl commented 9 years ago

i'm thinking of borrowing company-files code, i can compute a bunch of user provided include dirs. i can invoke clang to give me a bunch of system include dirs. then i could give user a list of candidates. but i need parts that the user has already input. i wonder how it will integrate into current irony code. i have not written elisp before (nor any lisp dialect). but i also don't see any point integrating it into the cpp server.

Sarcasm commented 9 years ago

For reference, I used to have some code for header completion https://github.com/Sarcasm/irony-mode/blob/v0.0.1-alpha/elisp/irony-pp.el

hotpxl commented 9 years ago

Hi. I wrote company-irony-c-headers that's supposed to work with irony-mode to provide header completion. I copied and modified code from company-c-headers and put things together. This is just informative and it would be greatly appreciated if you help test it.

Sarcasm commented 9 years ago

I will take a look, please remind me if you want more feedbacks.

hotpxl commented 9 years ago

Thank you for the comment. They are really useful! I have fixed them all. Comments are always welcomed.

Also, since I depend on irony--compile-options and irony--working-directory, it would be great if you intend to make it stable and public.

Another question. company-irony doesn't work when there is no .clang_complete file nor compilation database. It doesn't complete either according to C nor C++. But it does show some completion candidates. I wonder what it is doing on this condition.

Sarcasm commented 9 years ago

Also, since I depend on irony--compile-options and irony--working-directory, it would be great if you intend to make it stable and public.

I'm not ready to make such commitment, I planed some changes in the compilation database stuff (that's why I'm holding the release of a new version).

Another question. company-irony doesn't work when there is no .clang_complete file nor compilation database. It doesn't complete either according to C nor C++. But it does show some completion candidates. I wonder what it is doing on this condition.

It is a difficult thing to detect that it is not intentional that there is no compile options. And for libclang it is difficult to differentiate between missing compile options and incomplete buffer, libclang will try to complete stuff on incomplete code (completion is always in incomplete code so that make sense).

What helps the user IMHO, is to have something like flycheck. When you see that the includes aren't found, it is often the sign that the header search paths / compile options aren't properly configured.