﻿/*
8888888b.  .d8888b. 888888b.  888     888 .d8888b. 
888  "Y88bd88P  Y88b888  "88b 888     888d88P Y88b
888    888     .d88P888  .88P 888     888888    888
888    888    8888" 8888888K. 888     888888       
888    888     "Y8b.888  "Y88b888     888888  88888
888    888888    888888    888888     888888    888
888  .d88PY88b d88P888   d88PY88b. .d88PY88b d88P
8888888P"  "Y8888P" 8888888P"  "Y88888P"  "Y8888P88

GPL 3.0 - LICENSE included with git https://raw.githubusercontent.com/ic3y808/Docker-Studio/master/LICENSE
https://github.com/ic3y808/Docker-Studio
Jesse Nelson - 2016
*/
using System;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;

namespace DockerStudio.Outlining
{
	[Export(typeof(ITaggerProvider))]
	[TagType(typeof(IOutliningRegionTag))]
	[ContentType("text")]
	internal sealed class OutliningTaggerProvider : ITaggerProvider
	{
		public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
		{
			//create a single tagger for each buffer.
			Func<ITagger<T>> sc = delegate () { return new OutliningTagger(buffer) as ITagger<T>; };
			return buffer.Properties.GetOrCreateSingletonProperty<ITagger<T>>(sc);
		}
	}
}