The CustomSquiggleTagger example is not very useful as it assumes you willl only need to update the Squiggles after some external event. i.e. the MainControl constructor just calls 'this.RefreshSquiggleTags();', rather than after a document text change.
If instead, we move the contents of RefreshSquiggleTags() into an overide of GetTags in CustomSquiggleTagger, the squiggles are shown correctly but hovering the mouse does not produce the expected popup, e.g. 'Instance number 1'.
Here is my code for the GetTags override method in CustomSquiggleTagger:
public override IEnumerable<TagSnapshotRange<ISquiggleTag>> GetTags(NormalizedTextSnapshotRangeCollection snapshotRanges, object parameter)
{
if (snapshotRanges != null)
{
foreach (TextSnapshotRange range in snapshotRanges)
{
var snapshotText = range.GetText(LineTerminator.Newline);
// Look for regex pattern matches
var matches = Regex.Matches(snapshotText, @"\bActipro\b", RegexOptions.IgnoreCase);
for (var matchIndex = 0; matchIndex < matches.Count; matchIndex++)
{
var match = matches[matchIndex];
// Create a version range for the match
var snapshotRange = TextSnapshotRange.FromSpan(range.Snapshot, range.StartOffset + match.Index, match.Length);
// Create a tag, and include a quick info tip if specified
var tag = new SquiggleTag();
tag.ClassificationType = ClassificationTypes.Warning; // This classification type is mapped in the tagger to a Green color
tag.ContentProvider = new PlainTextContentProvider(String.Format("Instance number {0}", matchIndex + 1));
// Add the tag to the tagger
yield return new TagSnapshotRange<ISquiggleTag>(snapshotRange, tag);
}
}
}
}