Tags consumed by a call to TaggerBase.GetTags do not respect the snapshot version

SyntaxEditor for WPF Forum

Posted 9 years ago by Erel Uziel
Version: 14.2.0611
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

I'm returning tags with TagSnapshotRanges that are based on previous snapshots. Seems like the offsets are not calculated correctly and the ranges are cut in some cases.

 

If I first use TranslateTo to convert the version to the current version then it works properly.

Comments (3)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Erel,

Whch specific tagger class are you using?  TaggerBase.GetTags is abstract. 

And to verify, you are expecting to get snapshot range results for the now-current snapshot, but are getting them for an older one instead?


Actipro Software Support

Posted 9 years ago by Erel Uziel
Avatar

I've created a concrete class that inherits from TaggerBase<IClassificationTag>.

When I return TagSnapshotRanges from this method that are based on a previous snapshot (which I previously collected), the visual classifications are cut in some cases.

This is fixed by translating the old ranges before returning the results:

res.Add(new TagSnapshotRange<IClassificationTag>(tr.SnapshotRange.TranslateTo(snapshotRanges[0].Snapshot,  TextRangeTrackingModes.Default),tr.Tag));
Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Erel,

That is correct... since you are the one creating the results for the GetTags method, you would need to translate them.  In some of our implementations, when we get a request for a newer snapshot, we update our private collection of ranges in the tagger to be based on that newer snapshot and then return the results.  That way, as you continue getting additional new snapshot requests (as more edits take place), you have less work to translate forward as compared to only storing the ranges relative to the original snapshot.


Actipro Software Support

The latest build of this product (v24.1.1) 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.