Udostępnij za pośrednictwem


ICommonEditorAssetServiceFactory Interface

Definition

Service for getting a service that provides common language service elements.

public interface class ICommonEditorAssetServiceFactory
public interface ICommonEditorAssetServiceFactory
type ICommonEditorAssetServiceFactory = interface
Public Interface ICommonEditorAssetServiceFactory

Examples

This is a MEF component part. Use the code below in your MEF exported class to import an instance of the service factory.

[Import]
private ICommonEditorAssetServiceFactory assetServiceFactory = null;

Then, you can use the code below to get the ITaggerProvider for the Common Editor's IClassificationTagger. Modify as needed to get the desired asset.

var factory = this.assetServiceFactory.GetOrCreate(buffer);
var tagger = factory.FindAsset<ITaggerProvider>(
    (metadata) => metadata.TagTypes.Any(tagType => typeof(IClassificationTagger).IsAssignableFrom(tagType)))
    ?.CreateTagger<T>(buffer);

Remarks

This class supports the Visual Studio infrastructure and in general is not intended to be used directly from your code.

Methods

GetOrCreate(ITextBuffer)

Gets a service that provides common language service elements.

Applies to