Skip to content

semantic highlighter: Use a timer to reduce amount of requests being sent

Waqar Ahmed requested to merge work/semHigh7 into master

Currently we are sending requests on every typed character and everytime we change view. This can be really heavy on the server, especially with large documents. It results in problems such as "incorrect highlighting" because server isn't in sync with the latest changes in the document.

This change introduces a simple mechanism to fix this: Use a QTimer to reduce the amount of requests. Every time we type or change the current KTE::View this timer gets started/restarted and when it times out (timeout set to 2 seconds), it just refreshes the highlighting.

This means no more highlight-as-you-type, which is both good and bad but since we can't really control the servers, I think this is better.


I did try to use transformRange but that doesn't work at all if you are typing.

Signed-off-by: Waqar Ahmed waqar.17a@gmail.com

Edited by Waqar Ahmed

Merge request reports