diff options
Diffstat (limited to 'src/Text/Def/TextLogic/TextMate/ICommonEditorAssetServiceFactory.cs')
-rw-r--r-- | src/Text/Def/TextLogic/TextMate/ICommonEditorAssetServiceFactory.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Text/Def/TextLogic/TextMate/ICommonEditorAssetServiceFactory.cs b/src/Text/Def/TextLogic/TextMate/ICommonEditorAssetServiceFactory.cs new file mode 100644 index 0000000..36b618b --- /dev/null +++ b/src/Text/Def/TextLogic/TextMate/ICommonEditorAssetServiceFactory.cs @@ -0,0 +1,40 @@ +namespace Microsoft.VisualStudio.Editor +{ + using Microsoft.VisualStudio.Text; + + /// <summary> + /// Service for getting a service that provides common language service elements. + /// </summary> + /// <remarks>This class supports the Visual Studio + /// infrastructure and in general is not intended to be used directly from your code.</remarks> + /// <example> + /// This is a MEF component part. Use the code below in your MEF exported class to import an + /// instance of the service factory. + /// <code> + /// [Import] + /// private ICommonEditorAssetServiceFactory assetServiceFactory = null; + /// </code> + /// 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. + /// <code> + /// var factory = this.assetServiceFactory.GetOrCreate(buffer); + /// var tagger = factory.FindAsset<ITaggerProvider>( + /// (metadata) => metadata.TagTypes.Any(tagType => typeof(IClassificationTagger).IsAssignableFrom(tagType))) + /// ?.CreateTagger<T>(buffer); + /// </code> + /// </example> + public interface ICommonEditorAssetServiceFactory + { + /// <summary> + /// Gets a service that provides common language service elements. + /// </summary> + /// </summary> + /// <param name="textBuffer">The <see cref="ITextBuffer"/> for which to initialize TextMate.</param> + /// <remarks> + /// This method supports the Visual Studio infrastructure and in + /// general is not intended to be used directly from your code. + /// </remarks> + /// <returns>An instance of <see cref="ITextMateAssetService"/>.</returns> + ICommonEditorAssetService GetOrCreate(ITextBuffer textBuffer); + } +} |