예제 #1
0
        public static ITextBuffer CreateTextBuffer(this ITextBufferFactoryService textBufferFactoryService, IContentType contentType, params string[] lines)
        {
            textBufferFactoryService.ThrowOnNull(nameof(textBufferFactoryService));

            var textBuffer = contentType != null
                ? textBufferFactoryService.CreateTextBuffer(contentType)
                : textBufferFactoryService.CreateTextBuffer();

            if (lines.Length != 0)
            {
                var text = lines.Aggregate((x, y) => x + Environment.NewLine + y);
                textBuffer.Replace(new Span(0, 0), text);
            }

            return(textBuffer);
        }
예제 #2
0
 public static ITextBuffer CreateTextBuffer(this ITextBufferFactoryService textBufferFactoryService, params string[] lines)
 {
     textBufferFactoryService.ThrowOnNull(nameof(textBufferFactoryService));
     return(CreateTextBuffer(textBufferFactoryService, null, lines));
 }