InlineParameterNameHintsTaggerProvider.cs 1.7 KB
Newer Older
A
Ankita Khera 已提交
1 2 3 4
// 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.

A
Ankita Khera 已提交
5
using System;
A
Ankita Khera 已提交
6
using System.ComponentModel.Composition;
A
Ankita Khera 已提交
7
using Microsoft.CodeAnalysis.Host.Mef;
A
Ankita Khera 已提交
8 9 10 11 12
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;

A
Ankita Khera 已提交
13
namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
A
Ankita Khera 已提交
14
{
A
Ankita Khera 已提交
15 16 17 18
    /// <summary>
    /// 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
    /// </summary>
19
    [Export(typeof(ITaggerProvider))]
20
    [ContentType(ContentTypeNames.CSharpContentType)]
21
    [TagType(typeof(IntraTextAdornmentTag))]
22 23
    [Name(nameof(InlineParameterNameHintsTaggerProvider))]
    class InlineParameterNameHintsTaggerProvider : ITaggerProvider
A
Ankita Khera 已提交
24
    {
A
Ankita Khera 已提交
25
        private readonly IBufferTagAggregatorFactoryService _bufferTagAggregatorFactoryService;
A
Ankita Khera 已提交
26

A
Ankita Khera 已提交
27
        [ImportingConstructor]
A
Ankita Khera 已提交
28
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
29
        public InlineParameterNameHintsTaggerProvider(IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService)
A
Ankita Khera 已提交
30
        {
31
            _bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService;
A
Ankita Khera 已提交
32 33
        }

34
        public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
A
Ankita Khera 已提交
35
        {
36 37
            var tagAggregator = _bufferTagAggregatorFactoryService.CreateTagAggregator<InlineParameterNameHintDataTag>(buffer);
            return new InlineParameterNameHintsTagger(buffer, tagAggregator) as ITagger<T>;
A
Ankita Khera 已提交
38 39 40
        }
    }
}