private IProjectionBuffer CreateProjectionBuffer(string contentType = null, params ITrackingSpan[] spans) { return(contentType != null ? ProjectionBufferFactoryService.CreateProjectionBuffer(null, new List <object>(spans), ProjectionBufferOptions.None, ContentTypeRegistryService.GetContentType(contentType)) : ProjectionBufferFactoryService.CreateProjectionBuffer(null, new List <object>(spans), ProjectionBufferOptions.None)); }
protected override ITrackingSpan GetPreviousStatementBufferAndSpan(int contextPoint, Document document) { var previousTrackingSpan = ContextBuffer.CurrentSnapshot.CreateTrackingSpan(Span.FromBounds(0, contextPoint), SpanTrackingMode.EdgeNegative); // terminate the previous expression/statement var buffer = ProjectionBufferFactoryService.CreateProjectionBuffer( projectionEditResolver: null, sourceSpans: new object[] { previousTrackingSpan, this.StatementTerminator }, options: ProjectionBufferOptions.None, contentType: this.ContentType); return(buffer.CurrentSnapshot.CreateTrackingSpan(0, buffer.CurrentSnapshot.Length, SpanTrackingMode.EdgeNegative)); }
/// <summary> /// Create a simple IProjectionBuffer from the specified SnapshotSpan values /// </summary> public IProjectionBuffer CreateProjectionBuffer(params SnapshotSpan[] spans) { var list = new List <object>(); foreach (var span in spans) { var snapshot = span.Snapshot; var trackingSpan = snapshot.CreateTrackingSpan(span.Span, SpanTrackingMode.EdgeInclusive); list.Add(trackingSpan); } return(ProjectionBufferFactoryService.CreateProjectionBuffer( null, list, ProjectionBufferOptions.None)); }