Finer control over the timer that invokes parsers

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Finer control over the timer that invokes parsers

Postby preditcon » Fri Nov 15, 2013 10:43 am

Currently, a parser attached to an RSTA instance will get invoked after document changes stop and some time passes, controlled by a Swing timer. While this is okay, I'd like to also consider caret updates when restarting the timer. I only consider a document to be stable and ready for parsing, when a user stops typing and moving the caret around. Since parsing implies a minor GUI slowdown, it can be quite annoying if the slowdown occurs when you are still writing code, but have to reposition the caret (I find myself doing that quite often while writing code).

I believe org.fife.ui.rsyntaxtextarea.ParserManager is the class which handles when a parser is invoked, but cannot find code that would allow me to control the reparse timer. Is there a way to do what I described above? Subclassing won't be much help, since the timer instance is private (and there's also no way to obtain a ParserManager instance from RSTA).

There's an existing method, ParserManager.restartParsing(), that almost does what I'd want to happen on a caret update;

java code:

* Delays parsing the document.
* @see #stopParsing()
public void delayParsing() {
if (running) {
Posts: 27
Joined: Wed Jan 25, 2012 10:09 am

Return to Help

Who is online

Users browsing this forum: No registered users and 1 guest