Ejemplo n.º 1
0
#pragma warning restore 67

        /// <summary>
        /// Raises a fake changed low priority event
        /// </summary>
        public void RaiseChangedLowPriority()
        {
            var changed = ChangedLowPriority;

            if (changed != null)
            {
                var oldSnapshot = _snapshot;
                var newSnapshot = new MockTextSnapshot(this, _snapshot.GetText(), _snapshot,
                                                       new MockTextChange(
                                                           new SnapshotSpan(_snapshot, 0, _snapshot.Length),
                                                           0,
                                                           _snapshot.GetText()
                                                           )
                                                       );
                _snapshot = newSnapshot;
                changed(this, new TextContentChangedEventArgs(oldSnapshot, newSnapshot, EditOptions.None, null));
            }
        }
Ejemplo n.º 2
0
        public ITextSnapshot Replace(Span replaceSpan, string replaceWith)
        {
            var    oldText = _snapshot.GetText();
            string newText = oldText.Remove(replaceSpan.Start, replaceSpan.Length);

            newText = newText.Insert(replaceSpan.Start, replaceWith);

            _snapshot = new MockTextSnapshot(
                this,
                newText,
                _snapshot,
                new MockTextChange(
                    new SnapshotSpan(_snapshot, replaceSpan),
                    replaceSpan.Start,
                    replaceWith
                    )
                );
            return(_snapshot);
        }
Ejemplo n.º 3
0
 public MockTextEdit(MockTextSnapshot snapshot)
 {
     _snapshot = snapshot;
 }
Ejemplo n.º 4
0
 public MockTextVersion(int version, MockTextSnapshot snapshot)
 {
     _version  = version;
     _snapshot = snapshot;
 }