Why pass in snapshotRanges in GetTags?

SyntaxEditor for WPF Forum

Posted 13 years ago by Craig - Varigence, Inc.
Version: 11.1.0545
I'm writing a custom Tagger and I'm wondering why you guys chose to pass in a collection of snapshotRanges to GetTags. Looking at your sample, it seems like you use it to scan chunks of a file for text. But, you could just as easily scan the entire document. Is there a specific purpose or advantage to leveraging the snapshotRanges collection?



[Modified at 09/28/2011 08:05 PM]

Comments (1)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Craig,

Our line layout code loops through each line and tries to obtain appropriate tags for each line. This way everything is more virtualized so we aren't collecting data for lines we don't need to display. For large files, this makes a huge performance difference.

If I recall correctly, it is ranges instead of a single range for scenarios like collapsed text, so that it can skip over those regions and just ask for data related to the before and after portions that end up on the same display line.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.