Sarcasm / flycheck-irony

C, C++ and Objective-C support for Flycheck, using Irony Mode
56 stars 10 forks source link

Automatically recheck buffer when loading a irony-cdb #14

Open sezaru opened 8 years ago

sezaru commented 8 years ago

When I open a file from some cmake project, flycheck-irony will load normally, but I still doesn't have a cdb loaded, after I load it and run (irony-cdb-autosetup-compile-options, flycheck-irony will work as expected with any new file that I open from the project.

But, the file that I opened before loading the irony-cdb will only work if I edit something in it or reload flycheck-mode.

So, for example, I opened a hpp file which have a include to other file in my project, since the cdb is not loaded yet, flycheck will say that the path of the include is not found (for a lib for example). Then, I load the cdb, what I expect is that flycheck will see it and recheck my buffer, removing the include error since now it knows where to find it.

What happens is that the error continues until I reload flycheck or edit the buffer. I tried flycheck-buffer but it doesn't work.

So, there is some way to make flycheck recheck the buffer when a cdb is loaded (or at least a command that I can call to recheck it?).

Thanks

Sarcasm commented 8 years ago

I would expect flycheck-buffer to work, it works for me.

The test I made was:

  1. remove the irony-cdb-autosetup-compile-options from the mode-hook
  2. open a C++ file, that absence of compile options makes flycheck-irony report some errors
  3. call irony-cdb-autosetup-compile-options
  4. call flycheck-buffer. the buffer no longer reports any error

Could you try again? If that works for you, we could imagine to automate the recheck when irony-cdb-autosetup-compile-options is called.