I noticed that we sometimes wait quite long on code completion
requests, especially when editing header files. The edit operation
in a header invalidates the preamble, so reparsing will always take
quite some time. Nothing we can do about that, really. But at least
we can make sure we don't do work for naught:
The old code just emitted signals whenever code completion is invoked.
This can happen multiple times while we are editing the header. Since
the computation takes time, the subsequent completion requests pile
up and will all be handled eventually. If you are then impatient and
go to a different file, we will still go through all requests even
though they are not interesting anymore.
This patch groups the completion requests together with a simple
timer to ensure we only handle the last request once the current
completion job has finished.