// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
{
///
/// The provider that is used as a middleman to create the tagger so that the data tag
/// can be used to create the UI tag
///
[Export(typeof(ITaggerProvider))]
[ContentType("csharp")]
[TagType(typeof(IntraTextAdornmentTag))]
[Name(nameof(InlineParamNameHintsTaggerProvider))]
class InlineParamNameHintsTaggerProvider : ITaggerProvider
{
private readonly IBufferTagAggregatorFactoryService _bufferTagAggregatorFactoryService;
[ImportingConstructor]
public InlineParamNameHintsTaggerProvider(IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService)
{
_bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService;
}
public ITagger CreateTagger(ITextBuffer buffer) where T : ITag
{
var tagAggregator = _bufferTagAggregatorFactoryService.CreateTagAggregator(buffer);
return new InlineParamNameHintsTagger(buffer, tagAggregator) as ITagger;
}
}
}