Posted 12 years ago by Nick
Version: 12.2.0571
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

Hello,

Just installed the latest release and noticed that one of my taggers has stopped working. Calling OnTagsChanged no longer appears to trigger GetTags.

Nick.

Comments (5)

Posted 12 years ago by Nick
Avatar

(on .NET 4.0 / Win7)

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

Hi Nick,

What version did you have before this and what base class is your tagger?


Actipro Software Support

Posted 12 years ago by Nick
Avatar

I was running the previous release (I was up to date before installing the latest). The GetTags function never gets hit.

public class DifferencesTagger : TaggerBase<IClassificationTag>
{

...
 
private void HighlightDifferences()
    {
      if (view == null)
        return;

      // Notify that tags changed
      this.OnTagsChanged(new TagsChangedEventArgs(new TextSnapshotRange(view.SyntaxEditor.Document.CurrentSnapshot, view.SyntaxEditor.Document.CurrentSnapshot.TextRange)));
    }

    //return the text ranges which should be highlighted
    public override IEnumerable<TagSnapshotRange<IClassificationTag>> GetTags(NormalizedTextSnapshotRangeCollection snapshotRanges, object parameter)
    {
      if (parameter != null && m_Diffs != null)
      {
        var snr = (ActiproSoftware.Text.TextSnapshotRange)parameter;
        foreach (ChangeEvent ce in m_Diffs)
        {
          var node = ((HL7Message)m_Parent.Message).GetSubComponentFromPath(ce.Path, false);
          if (node != null)
          {
            int index = node.Offset - m_Parent.GetTagOffset(node.Offset);
            if (snr.StartOffset <= index && snr.EndOffset >= index)
            {
              yield return new TagSnapshotRange<IClassificationTag>(
                           new TextSnapshotRange(this.view.CurrentSnapshot, TextRange.FromSpan(index, ce.CurrentValue.Length)),
                           new ClassificationTag(m_Parent.HighlightOnlyDeleted ? wordHighlightClassificationTypeDeleted : (ce.ChangeType == ChangeType.Added) ? wordHighlightClassificationTypeAdded : wordHighlightClassificationType));
            }
          }
        }
      }
    }

}
 

[Modified 12 years ago]

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

Hi Nick,

I just compared build 570 with 571 (latest) and nothing was changed in TaggerBase or any of the other tag-related classes in the Text assembly.  In the SyntaxEditor assembly though we did change the TextViewTagAggregator to begin-invoke the TagsChanged event instead of invoking TagsChanged.  But that seems to be the only change made between the two builds in the tagging area.

[Modified 12 years ago]


Actipro Software Support

Answer - Posted 12 years ago by Nick
Avatar

I've just tracked it down I think. I had multiple taggers, and it appeared that only the first one was being registered. When I compared them, they all had the same first paramater value in their constructors:

public SomeTagger(IEditorView view) 
      : base("Custom", ...

 All my taggers had the text "Custom". I've now changed them to make them all unique, and this appears to have fixed the problem.

Nick.

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

Add Comment

Please log in to a validated account to post comments.