void Console_NewColorSpan(object sender, EventArgs <Tuple <SnapshotSpan, Color?, Color?> > e) { // At least one of foreground or background must be specified, otherwise we don't care. if (e.Arg.Item2 != null || e.Arg.Item3 != null) { _colorSpans.Add(Tuple.Create( e.Arg.Item1.Span, TextFormatClassifier.GetClassificationType(e.Arg.Item2, e.Arg.Item3))); ClassificationChanged.Raise(this, new ClassificationChangedEventArgs(e.Arg.Item1)); } }
private void TextBuffer_Changed(object sender, TextContentChangedEventArgs e) { // When input line changes, raise ClassificationChanged event if (HasConsole && Console.InputLineStart != null) { SnapshotSpan commandExtent = Console.InputLineExtent; if (e.Changes.Any(c => c.OldPosition >= commandExtent.Span.Start)) { if (_commandLineSpans.Count > 0) { int i = _commandLineSpans.FindCommandStart(_commandLineSpans.Count - 1); commandExtent = new SnapshotSpan( new SnapshotPoint(commandExtent.Snapshot, _commandLineSpans[i].Item1.Start), commandExtent.End); } ClassificationChanged.Raise(this, new ClassificationChangedEventArgs(commandExtent)); } } }