Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 252 forks source link

automatic/idle flycheck? #645

Closed blaenk closed 8 years ago

blaenk commented 8 years ago

I saw 13e2ef9311c965ef872649c3d0209c9cfba50a42 and I'm wondering if it's possible, or planned, to be leverage flycheck's automatic checking. For example, with irony I can type and if I'm idle for a bit, it'll check the file. I do like that rtags provides much more accurate highlighting overlays though, but it seems like it'll only check when I explicitly save the file? Is there a way to make it trigger whenever flycheck would automatically trigger? It'd be very nice! I've gotten used to not having to save to test the code and I've found that it helps to keep me on my feet.

Andersbakken commented 8 years ago

That's a good idea. I'll look into adding something.

Anders

On Sun, Mar 27, 2016 at 6:54 PM, Jorge Israel Peña <notifications@github.com

wrote:

I saw 13e2ef9 https://github.com/Andersbakken/rtags/commit/13e2ef9311c965ef872649c3d0209c9cfba50a42 and I'm wondering if it's possible, or planned, to be leverage flycheck's automatic checking. For example, with irony I can type and if I'm idle for a bit, it'll check the file. I do like that rtags provides much more accurate highlighting overlays though, but it seems like it'll only check when I explicitly save the file? Is there a way to make it trigger whenever flycheck would automatically trigger? It'd be very nice! I've gotten used to not having to save to test the code and I've found that it helps to keep me on my feet.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/Andersbakken/rtags/issues/645

Andersbakken commented 8 years ago

You should now be able to set rtags-periodic-reparse-timeout to a floating point value (seconds) to enable this feature.

In short, if you set it to 2.0 diagnostics will be performed after 2 seconds of not doing anything.

Let me know if it works for you.

Anders

On Sun, Mar 27, 2016 at 11:55 PM, Anders Bakken agbakken@gmail.com wrote:

That's a good idea. I'll look into adding something.

Anders

On Sun, Mar 27, 2016 at 6:54 PM, Jorge Israel Peña < notifications@github.com> wrote:

I saw 13e2ef9 https://github.com/Andersbakken/rtags/commit/13e2ef9311c965ef872649c3d0209c9cfba50a42 and I'm wondering if it's possible, or planned, to be leverage flycheck's automatic checking. For example, with irony I can type and if I'm idle for a bit, it'll check the file. I do like that rtags provides much more accurate highlighting overlays though, but it seems like it'll only check when I explicitly save the file? Is there a way to make it trigger whenever flycheck would automatically trigger? It'd be very nice! I've gotten used to not having to save to test the code and I've found that it helps to keep me on my feet.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/Andersbakken/rtags/issues/645

sbroberg commented 8 years ago

I was going to request the same feature. I can confirm your change works for me, with only one caveat - the file is not parsed upon opening (which flycheck does). I'm assuming there is some other variable that existed before that does this, and is disabled to save cpu, assuming that a newly-opened file is already correct.

casch-at commented 8 years ago

@Andersbakken I tried this right now it does work, however, if I stay in the buffer doing nothing rtags-periodic-reparse-buffer will be called as fast as possibly again and again after idle time is over. It does stop after doing something again in emacs.

rtags-update-periodic-reparse-timer [13101 times]

Luckily I found out why this happens, this happens because rtags-post-command-hook calls rtags-update-periodic-reparse-timer, which is added to the post-command-hook variable, which gets called every time a command in emacs gets executed. In other words kind of recursion.

casch-at commented 8 years ago

@Andersbakken @sbroberg @blaenk I fixed the mentioned issue in my previous post.

You should now use the function rtags-set-periodic-reparse-timeout or defcustom to set or unset this feature, see the Documentation of rtags-periodic-reparse-timeout for a more comprehensive description.