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

Force rescan of header files and rebuild #553

Open nwg opened 4 years ago

nwg commented 4 years ago

Is there a command to force rescan of header files?

It seems if i add a #include i do not get completion right away for that header. If i quit out of emacs completely and reload the file then i get completion for that header.

Likewise, if i delete the header, the completions do not go away for that header.

Is there any way to force the database to reset or rescan the header files with maybe a key binding?

I should mention i am using irony-mode with company-mode and company-irony and company-irony-c-headers

nwg commented 4 years ago

This seems to be solved for me with the flycheck-irony package, although it would be nice to have something to reload for people who do not wish to use flycheck.

3246251196 commented 4 years ago

I have the need to reparse sometimes too. I just set up a standard emacs timer to call irony-parse-buffer-async every few minutes iff I am in a relevant cpp/project file.

jose-joaquim commented 4 years ago

I came up with this problem today. I noticed this problem using this example repository.

I executed the command the echo "-I./my_inc" > .clang_complete in the project root to enable irony-mode, but it appears to not work properly. For headers in a different path (for example, "my_inc/myadd.h"), any alterations do not seem to have any effect within src/main.cpp until quitting Emacs and opening again, as the author of the topic described.

However, at least in my case, quit and open Emacs to force reload was not necessary for files in the same directory. For instance, if I'm at main.cpp (src/main.cpp) and perform some change in helper.h, this change seems to take effect right away, as it should be.

I'm using 26.3 in a macOS 10.15.5.