by robert » Thu Mar 29, 2012 12:58 pm
This would be tough to do, because we'd have to clone the Document to have a snapshot of what to parse for the parsing Thread. Then, what do we do if the user edits the original Document before the Parser is done, and his ParserNotices don't match up with what the user is looking at?
I suppose we could put a read-lock on the Document and do all parsing on another Thread. This would allow the user to scroll around, and keep the UI responsive, but they could not edit the Document until the Parser completed. This might not be too difficult to implement, but I'm not sure if there are any other implications to doing things this way. This would also incur a good amount of overhead for simpler parsers (though even simple Parsers often do a fair amount of work themselves, such as spawn an external process to run a compiler).
I'll think about it, maybe there's something I haven't thought of yet. Any suggestions?
This would be tough to do, because we'd have to clone the Document to have a snapshot of what to parse for the parsing Thread. Then, what do we do if the user edits the original Document before the Parser is done, and his ParserNotices don't match up with what the user is looking at?
I suppose we could put a read-lock on the Document and do all parsing on another Thread. This would allow the user to scroll around, and keep the UI responsive, but they could not edit the Document until the Parser completed. This might not be too difficult to implement, but I'm not sure if there are any other implications to doing things this way. This would also incur a good amount of overhead for simpler parsers (though even simple Parsers often do a fair amount of work themselves, such as spawn an external process to run a compiler).
I'll think about it, maybe there's something I haven't thought of yet. Any suggestions?