Udostępnij za pośrednictwem


ITextDifferencingService2.DiffSnapshotSpans Method

Definition

Overloads

DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions, IEqualityComparer<String>)

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

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

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

DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions, IEqualityComparer<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, System.Collections.Generic.IEqualityComparer<string>? comparer);
abstract member DiffSnapshotSpans : Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.Differencing.StringDifferenceOptions * System.Collections.Generic.IEqualityComparer<string> -> Microsoft.VisualStudio.Text.Differencing.IHierarchicalDifferenceCollection
Public Function DiffSnapshotSpans (left As SnapshotSpan, right As SnapshotSpan, differenceOptions As StringDifferenceOptions, comparer As IEqualityComparer(Of 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.

comparer
IEqualityComparer<String>

An equality comparer that, if non-null, determines if two strings should be considered equal and overrides other comparison options (e.g. IgnoreTrimWhiteSpace)

Returns

A hierarchical collection of differences.

Applies to

DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions, Func<ITextSnapshotLine,String>, IEqualityComparer<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,string> getLineTextCallback, System.Collections.Generic.IEqualityComparer<string>? comparer);
abstract member DiffSnapshotSpans : Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Text.Differencing.StringDifferenceOptions * Func<Microsoft.VisualStudio.Text.ITextSnapshotLine, string> * System.Collections.Generic.IEqualityComparer<string> -> Microsoft.VisualStudio.Text.Differencing.IHierarchicalDifferenceCollection
Public Function DiffSnapshotSpans (left As SnapshotSpan, right As SnapshotSpan, differenceOptions As StringDifferenceOptions, getLineTextCallback As Func(Of ITextSnapshotLine, String), comparer As IEqualityComparer(Of 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).

comparer
IEqualityComparer<String>

An equality comparer that, if non-null, determines if two strings should be considered equal and overrides other comparison options (e.g. IgnoreTrimWhiteSpace)

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