// Produces tags on the snapshot that the tag consumer asked for. public virtual IEnumerable <ITagSpan <IntraTextAdornmentTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (spans == null) { yield break; } var requestedSnapshot = spans[0].Snapshot; spans = new NormalizedSnapshotSpanCollection(spans.Select(span => span.TranslateTo(snapshot, SpanTrackingMode.EdgeExclusive))); //Dont add ignored spans if (ignoredSpan.HasValue) { ignoredSpan = ignoredSpan.Value.TranslateTo(snapshot, SpanTrackingMode.EdgeExclusive); var spanList = spans.ToList(); var intersectingWithIgnored = spans.ToList().Where(span => span.IntersectsWith(ignoredSpan.Value)); if (intersectingWithIgnored.Count() > 1) { throw new NotImplementedException(); } foreach (var span in intersectingWithIgnored) { spanList.Remove(span); } spans = new NormalizedSnapshotSpanCollection(spanList); } if (spans.Count == 0) { yield break; } // Translate the request to the snapshot that this tagger is current with. //Remove spans that are under the marker //var caretPos = view.Caret.Position.BufferPosition.Position; //translatedSpans = new NormalizedSnapshotSpanCollection(translatedSpans.Where(span => caretPos < span.Start || caretPos > span.End)); // Grab the adornments. foreach (var tagSpan in GetAdornmentTagsOnSnapshot(spans)) { // Translate each adornment to the snapshot that the tagger was asked about. var span = tagSpan.Span.TranslateTo(requestedSnapshot, SpanTrackingMode.EdgeExclusive); var tag = new IntraTextAdornmentTag(tagSpan.Tag.Adornment, tagSpan.Tag.RemovalCallback, tagSpan.Tag.Affinity); yield return(new TagSpan <IntraTextAdornmentTag>(span, tag)); } }
private void ProcessSomeMembersThreaded(object o) { NotifyStatusbar(DeadAnnotationStatus.Started); var prog = ((ThreadParams)o).P; var snap = ((ThreadParams)o).S; var stop = ((ThreadParams)o).Stop; var mds = ((ThreadParams)o).M; var dare = new Dare.Dare(stop); List <DareResult> results; _lastRunChangeCount = _changesSinceLastSuccessfulRun.Count; try { results = dare.ProcessMembers(prog, mds); } catch (NotValidException) { _lastRunFailed = true; NotifyStatusbar(DeadAnnotationStatus.DaryFailInvalid); Finish(); return; } _lastRunFailed = false; if (_currentStopper.Stop) { NotifyStatusbar(DeadAnnotationStatus.UserInterrupt); Finish(); return; } _changesSinceLastSuccessfulRun.Clear(); var changed = new List <SnapshotSpan>(); lock (_deadAnnotations) { var toremove = _errList.Tasks.Cast <Task>().Where(task => task.HelpKeyword == DeadAnnotationTag.Help).ToList(); toremove.ForEach(_errList.Tasks.Remove); foreach (var m in mds) { var mSpan = new SnapshotSpan(snap, m.BodyStartTok.pos, m.BodyEndTok.pos - m.BodyStartTok.pos); _deadAnnotations.RemoveAll(tag => tag.TrackingReplacementSpan.GetSpan(snap).OverlapsWith(mSpan)); } results.ForEach(x => changed.Add(ProcessValidResult(x).TrackingReplacementSpan.GetSpan(Snapshot))); } _deadAnnotations.ForEach(t => _errList.Tasks.Add(t.Task)); var normalizedChanges = new NormalizedSnapshotSpanCollection(changed); normalizedChanges.ToList().ForEach(x => TagsChanged?.Invoke(this, new SnapshotSpanEventArgs(x))); NotifyStatusbar(DeadAnnotationStatus.Finished); Finish(); }