/// <summary> /// Visits the specified TextSpand and generates a tag, if it matches with the line number /// </summary> /// <param name="line">Line to add the tag for</param> /// <param name="textSpan">TextSpan to match</param> /// <param name="lineNo">Line number</param> /// <param name="collectedSpans">List of spans collected</param> /// <param name="spanType">Type of span to create</param> private void Visit(ITextSnapshotLine line, TextSpan?textSpan, int lineNo, List <TagSpan <Z80TestTokenTag> > collectedSpans, Z80TestTokenType spanType) { if (lineNo >= textSpan?.StartLine && lineNo <= textSpan.Value.EndLine) { collectedSpans.Add(CreateSpan(line, textSpan.Value, spanType)); } }
/// <summary> /// Creates a snaphot span from an other snapshot span and a text span /// </summary> private static TagSpan <Z80TestTokenTag> CreateSpan(ITextSnapshotLine line, TextSpan text, Z80TestTokenType tokenType) { var tagSpan = new Span(line.Start.Position + text.StartColumn, text.EndColumn - text.StartColumn + 1); var span = new SnapshotSpan(line.Snapshot, tagSpan); var tag = new Z80TestTokenTag(tokenType); return(new TagSpan <Z80TestTokenTag>(span, tag)); }
/// <summary> /// Initializes a new instance of the <see cref="T:System.Object" /> class. /// </summary> public Z80TestTokenTag(Z80TestTokenType type) { Type = type; }