/// <summary> /// Visits the specified UVSS document and returns a list of classification spans that /// intersect with the specified span. /// </summary> /// <param name="document">The document to visit.</param> /// <param name="span">The span for which to retrieve classification spans.</param> /// <returns>The classification spans that intersect with the specified span.</returns> public IList <ClassificationSpan> VisitDocument(UvssTextParserResult result, SnapshotSpan span) { if (result.Document == null) { return(null); } span = span.TranslateTo(result.Snapshot, SpanTrackingMode.EdgeExclusive); var results = new List <ClassificationSpan>(); var visitor = new UvssClassifierVisitor(registry, (start, width, type, kind) => { var nodeSpan = new SnapshotSpan(span.Snapshot, start, width); if (nodeSpan.IntersectsWith(span)) { results.Add(new ClassificationSpan(nodeSpan, type)); } }); visitor.Visit(result.Document); return(results); }
/// <summary> /// Visits the specified UVSS document and returns a list of classification spans that /// intersect with the specified span. /// </summary> /// <param name="document">The document to visit.</param> /// <param name="span">The span for which to retrieve classification spans.</param> /// <returns>The classification spans that intersect with the specified span.</returns> public IList<ClassificationSpan> VisitDocument(UvssTextParserResult result, SnapshotSpan span) { if (result.Document == null) return null; span = span.TranslateTo(result.Snapshot, SpanTrackingMode.EdgeExclusive); var results = new List<ClassificationSpan>(); var visitor = new UvssClassifierVisitor(registry, (start, width, type, kind) => { var nodeSpan = new SnapshotSpan(span.Snapshot, start, width); if (nodeSpan.IntersectsWith(span)) results.Add(new ClassificationSpan(nodeSpan, type)); }); visitor.Visit(result.Document); return results; }