예제 #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));
            }
        }
예제 #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);
        }
예제 #3
0
 public MockTextEdit(MockTextSnapshot snapshot)
 {
     _snapshot = snapshot;
 }
예제 #4
0
 public MockTextVersion(int version, MockTextSnapshot snapshot)
 {
     _version  = version;
     _snapshot = snapshot;
 }