public void TestCreateProjectionBufferWithoutIndentation() { var exportProvider = TestExportProvider.ExportProviderWithCSharpAndVisualBasic; var contentTypeRegistryService = exportProvider.GetExportedValue <IContentTypeRegistryService>(); var textBuffer = exportProvider.GetExportedValue <ITextBufferFactoryService>().CreateTextBuffer( @" line 1 line 2 line 3 line 4", contentTypeRegistryService.GetContentType("text")); var projectionBuffer = IProjectionBufferFactoryServiceExtensions.CreateProjectionBufferWithoutIndentation( exportProvider.GetExportedValue <IProjectionBufferFactoryService>(), exportProvider.GetExportedValue <IContentTypeRegistryService>(), exportProvider.GetExportedValue <IEditorOptionsFactoryService>().GlobalOptions, textBuffer.CurrentSnapshot, "...", LineSpan.FromBounds(0, 1), LineSpan.FromBounds(2, 4)); var projectionSnapshot = projectionBuffer.CurrentSnapshot; Assert.Equal(4, projectionSnapshot.LineCount); var lines = projectionSnapshot.Lines.ToList(); Assert.Equal("line 1", lines[0].GetText()); Assert.Equal("...", lines[1].GetText()); Assert.Equal("line 3", lines[2].GetText()); Assert.Equal(" line 4", lines[3].GetText()); }
public void TestCreateElisionBufferWithoutIndentation() { var exportProvider = EditorTestCompositions.Editor.ExportProviderFactory.CreateExportProvider(); var contentTypeRegistryService = exportProvider.GetExportedValue <IContentTypeRegistryService>(); var textBuffer = exportProvider .GetExportedValue <ITextBufferFactoryService>() .CreateTextBuffer( @" line 1 line 2 line 3", contentTypeRegistryService.GetContentType("text") ); var elisionBuffer = IProjectionBufferFactoryServiceExtensions.CreateProjectionBufferWithoutIndentation( exportProvider.GetExportedValue <IProjectionBufferFactoryService>(), exportProvider.GetExportedValue <IEditorOptionsFactoryService>().GlobalOptions, contentType: null, exposedSpans: textBuffer.CurrentSnapshot.GetFullSpan() ); var elisionSnapshot = elisionBuffer.CurrentSnapshot; Assert.Equal(3, elisionSnapshot.LineCount); foreach (var line in elisionSnapshot.Lines) { Assert.True(line.GetText().StartsWith("line", StringComparison.Ordinal)); } }