Beispiel #1
0
 public TestTextSection(TestText testText, string label, TestTextPosition start, TestTextPosition end = null)
 {
     _testText = testText;
     Label     = label;
     Start     = start;
     End       = end;
 }
        public static StubWpfTextView CreateTextView(StubIdeScope ideScope, TestText inputText, string newLine = null, IProjectScope projectScope = null, string contentType = "deveroom", string filePath = null)
        {
            var textBuffer = VsxStubObjects.CreateTextBuffer(inputText.ToString(newLine));

            textBuffer.Properties.AddProperty(typeof(IProjectScope), projectScope);
            if (filePath != null)
            {
                textBuffer.Properties.AddProperty(typeof(IVsTextBuffer), new FilePathProvider(filePath));
            }
            var textView = new StubWpfTextView(textBuffer);

            if (contentType == "deveroom")
            {
                var tagAggregator = new StubBufferTagAggregatorFactoryService(ideScope).CreateTagAggregator <DeveroomTag>(textView.TextBuffer);
                tagAggregator.GetTags(new SnapshotSpan(textView.TextSnapshot, 0, textView.TextSnapshot.Length)).ToArray();
            }

            inputText.SetSelection(textView);
            inputText.SetCaret(textView);

            return(textView);
        }