Compartir a través de


ITextDifferencingService2 Interface

Definition

This service has methods that compute differences over strings, snapshots, and spans. Differences are computed according to the specified StringDifferenceTypes, starting with the most general type (line is more general than word, and word is more general than character). This service is meant to be provided by extenders to override the diff behavior by content type, thus allowing more control over the differences produced and how they align semantically (based upon the given language/content type).

public interface ITextDifferencingService2 : Microsoft.VisualStudio.Text.Differencing.ITextDifferencingService
type ITextDifferencingService2 = interface
    interface ITextDifferencingService
Public Interface ITextDifferencingService2
Implements ITextDifferencingService
Implements

Remarks

This is a MEF component part, and should be exported with the following attribute:

[Export(typeof(ITextDifferencingService))]

Component exporters must add at least one content type attribute to specify the content types for which the component is valid, such as:

[ContentType("basic")]

Use the ITextDifferencingSelectorService to get the most specific ITextDifferencingService for a particular content type.

Implementors of this class are free to interpret differencing fairly liberally. For example, a text differencing service for C# files could perform differencing by namespace/class/method, and then return these results in line form (or whatever is requested by the StringDifferenceOptions). To that end, the results returned are also allowed to be non-minimal, allowing implementations to return results that fit better into the semantic model of a given language (in order to try to more closely match user intent, instead of being technically minimal). The normal contract of IDifferenceCollection<T> does still apply, however, in that differences cannot overlap, are sorted, etc.

When calling into an instance of this interface and choosing a WordSplitBehavior, you should be using LanguageAppropriate, unless a different word splitting behavior is explicitly needed. This allows the individual implementation latitude to apply the best word splitting rules for the given content type.

Methods

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, Func<ITextSnapshotLine,String>)

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

(Inherited from ITextDifferencingService)
DiffSnapshotSpans(SnapshotSpan, SnapshotSpan, StringDifferenceOptions, IEqualityComparer<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.

(Inherited from ITextDifferencingService)
DiffStrings(String, String, StringDifferenceOptions, IEqualityComparer<String>)

Computes the differences between two strings, using the given difference options.

DiffStrings(String, String, StringDifferenceOptions)

Computes the differences between two strings, using the given difference options.

(Inherited from ITextDifferencingService)

Applies to