|Implementing IPartitionTokenScanner With Multi-Line Tokens [message #515176]
||Thu, 18 February 2010 00:58
| Andrew Lindesay
Registered: February 2010
(I hope I have the right forum)
I am implementing a class which conforms to IPartitionTokenScanner as part of implementing source-highlghting. It is generally working well with one little exception which I don't really entirely understand from reading the java-doc and Googling for information.
In my case, the text partitions can by multi-line which is working just fine when the document first loads as the scanner is able to traverse the lines from the start of the document looking for the partitions. The problem arises when the user edits some text in the middle of a multi-line partition. In this case, the 'IPartitionTokenScanner' has the method 'setPartialRange' invoked with an offset and length of the one line which was changed rather than the start of the token on some prior line.
When I think about this behaviour, it makes sense or the system would need to ask the 'IPartitionTokenScanner' to scan all of the text for every change which would be quite slow. I just wonder, what am I supposed to do to signal the partition? Should I accept that this scan is being requested in the middle of an existing partition and try to work back to the start of the partition somehow? Should it return tokens with offset and length that cover the larger partition or just the line that was requested?
Powered by FUDForum
. Page generated in 0.02145 seconds