Share via


ITextDifferencingService.DiffSnapshotSpans Method

Definition

Overloads

DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions)

Computes the differences between two snapshot spans, using the given difference options.

DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions, Func<ITextSnapshotLine,String>)

Computes the differences between two snapshot spans, using the given difference options.

DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions)

Computes the differences between two snapshot spans, using the given difference options.

public:
 Microsoft::VisualStudio::Text::Differencing::IHierarchicalDifferenceCollection ^ DiffSnapshotSpans(Microsoft::VisualStudio::Text::SnapshotSpan left, Microsoft::VisualStudio::Text::SnapshotSpan right, Microsoft::VisualStudio::Text::Differencing::StringDifferenceOptions differenceOptions);
public Microsoft.VisualStudio.Text.Differencing.IHierarchicalDifferenceCollection DiffSnapshotSpans (Microsoft.VisualStudio.Text.SnapshotSpan left, Microsoft.VisualStudio.Text.SnapshotSpan right, Microsoft.VisualStudio.Text.Differencing.StringDifferenceOptions differenceOptions);
abstract member DiffSnapshotSpans : Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.Differencing.StringDifferenceOptions -> Microsoft.VisualStudio.Text.Differencing.IHierarchicalDifferenceCollection
Public Function DiffSnapshotSpans (left As SnapshotSpan, right As SnapshotSpan, differenceOptions As StringDifferenceOptions) As IHierarchicalDifferenceCollection

Parameters

left
SnapshotSpan

The left span. In most cases this is from an "old" snapshot.

right
SnapshotSpan

The right span. In most cases this is from a "new" snapshot.

differenceOptions
StringDifferenceOptions

The options to use.

Returns

A hierarchical collection of differences.

Applies to

DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions, Func<ITextSnapshotLine,String>)

Computes the differences between two snapshot spans, using the given difference options.

public:
 Microsoft::VisualStudio::Text::Differencing::IHierarchicalDifferenceCollection ^ DiffSnapshotSpans(Microsoft::VisualStudio::Text::SnapshotSpan left, Microsoft::VisualStudio::Text::SnapshotSpan right, Microsoft::VisualStudio::Text::Differencing::StringDifferenceOptions differenceOptions, Func<Microsoft::VisualStudio::Text::ITextSnapshotLine ^, System::String ^> ^ getLineTextCallback);
public Microsoft.VisualStudio.Text.Differencing.IHierarchicalDifferenceCollection DiffSnapshotSpans (Microsoft.VisualStudio.Text.SnapshotSpan left, Microsoft.VisualStudio.Text.SnapshotSpan right, Microsoft.VisualStudio.Text.Differencing.StringDifferenceOptions differenceOptions, Func<Microsoft.VisualStudio.Text.ITextSnapshotLine,string> getLineTextCallback);
abstract member DiffSnapshotSpans : Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.Differencing.StringDifferenceOptions * Func<Microsoft.VisualStudio.Text.ITextSnapshotLine, string> -> Microsoft.VisualStudio.Text.Differencing.IHierarchicalDifferenceCollection
Public Function DiffSnapshotSpans (left As SnapshotSpan, right As SnapshotSpan, differenceOptions As StringDifferenceOptions, getLineTextCallback As Func(Of ITextSnapshotLine, String)) As IHierarchicalDifferenceCollection

Parameters

left
SnapshotSpan

The left span. In most cases this is from an "old" snapshot.

right
SnapshotSpan

The right span. In most cases this is from a "new" snapshot.

differenceOptions
StringDifferenceOptions

The options to use.

getLineTextCallback
Func<ITextSnapshotLine,String>

A callback for retrieving the text of snapshot lines (when performing differencing at the line level) that can optionally filter/modify the text, as long as it doesn't introduce line breaks (i.e. split the given line into multiple lines).

Returns

A hierarchical collection of differences.

Remarks

The getLineTextCallback can be used for things like ignoring all intraline whitespace or case during line differencing.

Also, the getLineTextCallback is only used for line-level differencing. If word/character differencing is requested, the implementation should use the original snapshot text directly, as there is no guaranteed way to map from words in a filtered line back to the original line.

The getLineTextCallback will be called only for full lines that intersect each requested SnapshotSpan. If a line only partially intersects the given left or right span, then the intersection of the line and the span is used directly.

Applies to