IProjectionBuffer.ReplaceSpans Method

Replaces a sequence of source spans with a new list of ITrackingSpan objects and/or literal strings.

Namespace:  Microsoft.VisualStudio.Text.Projection
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

IProjectionSnapshot ReplaceSpans(
	int position,
	int spansToReplace,
	IList<Object> spansToInsert,
	EditOptions options,
	Object editTag
)

Parameters

position
Type: Int32

The position at which to begin replacing spans.

spansToReplace
Type: Int32

The number of spans to replace.

spansToInsert
Type: IList<Object>

The new spans to insert.

options
Type: Microsoft.VisualStudio.Text.EditOptions

Options to apply to the span edit.

editTag
Type: Object

An object that will be associated with this edit transaction.

ExceptionCondition
ArgumentNullException

spansToInsert is null or a span in the list are null.

ArgumentOutOfRangeException

position is less than zero or greater than the number of spans.

-or-

spansToReplace is less than zero or position + spansToReplace is greater than the number of spans.

ArgumentException

An element of spansToInsert is neither an ITrackingSpan nor a string.

-or-

A span in spansToInsert would cause a duplicated projection.

-or-

A tracking span in spansToInsert is EdgeInclusive and does not cover its entire buffer, or is EdgePositive and does not abut the end of its buffer, or is EdgeNegative and does not abut the beginning of its buffer.

(These checks are not performed if the projection buffer was created with the PermissiveEdgeInclusiveSourceSpans.)

-or-

Adding a text buffer containing one of the spansToInsert would create a cycle among a set of projection buffers.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft