コード例 #1
0
ファイル: GotoDefinitionTest.cs プロジェクト: skrutsick/RTVS
        private TextViewMock SetupTextView(string content, int startLineNumber, int startColumn)
        {
            var document = new EditorDocumentMock(content);
            var tv       = new TextViewMock(document.TextBuffer());
            var line     = document.EditorBuffer.CurrentSnapshot.GetLineFromLineNumber(startLineNumber);

            tv.Caret.MoveTo(new SnapshotPoint(tv.TextBuffer.CurrentSnapshot, line.Start + startColumn));
            return(tv);
        }
コード例 #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);
        }