示例#1
0
        private void GetPeekableItems(string content, int position, IList <IPeekableItem> items)
        {
            var document = new EditorDocumentMock(content, @"C:\file.r");

            TextViewMock textView = new TextViewMock(document.TextBuffer, position);

            textView.Caret.MoveTo(new SnapshotPoint(textView.TextBuffer.CurrentSnapshot, position));

            var peekSession = PeekSessionMock.Create(textView, position);
            var factory     = PeekResultFactoryMock.Create();
            var peekSource  = new PeekableItemSource(textView.TextBuffer, factory);

            peekSource.AugmentPeekSession(peekSession, items);
        }
示例#2
0
        private void GetPeekableItems(string content, int position, IList <IPeekableItem> items, ITextRange selection = null)
        {
            var document = new EditorDocumentMock(content, @"C:\file.r");
            var textView = new TextViewMock(document.TextBuffer(), position);

            if (selection != null)
            {
                textView.Selection.Select(new SnapshotSpan(document.TextBuffer().CurrentSnapshot, new Span(selection.Start, selection.Length)), isReversed: false);
                textView.Caret.MoveTo(new SnapshotPoint(textView.TextBuffer.CurrentSnapshot, selection.End));
            }
            else
            {
                textView.Caret.MoveTo(new SnapshotPoint(textView.TextBuffer.CurrentSnapshot, position));
            }

            var peekSession = PeekSessionMock.Create(textView, position);
            var factory     = PeekResultFactoryMock.Create();
            var peekSource  = new PeekableItemSource(textView.TextBuffer, factory, _services);

            peekSource.AugmentPeekSession(peekSession, items);
        }