ActiveStatementTaggerProvider.cs 1.3 KB
Newer Older
J
Jonathon Marolf 已提交
1 2 3
// 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.
4

5 6
#nullable enable

7
using System;
8
using System.ComponentModel.Composition;
9
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
10
using Microsoft.CodeAnalysis.Host.Mef;
11 12 13 14 15 16 17 18 19 20 21 22 23
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;

namespace Microsoft.CodeAnalysis.Editor.Implementation.EditAndContinue
{
    [Export(typeof(ITaggerProvider))]
    [TagType(typeof(TextMarkerTag))]
    [ContentType(ContentTypeNames.RoslynContentType)]
    [TextViewRole(PredefinedTextViewRoles.Editable)] // TODO (tomat): ?
    internal sealed class ActiveStatementTaggerProvider : ITaggerProvider
    {
24 25
        private readonly IThreadingContext _threadingContext;

26
        [ImportingConstructor]
27
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
28
        public ActiveStatementTaggerProvider(IThreadingContext threadingContext)
29
            => _threadingContext = threadingContext;
30

31
        public ITagger<T>? CreateTagger<T>(ITextBuffer buffer) where T : ITag
32
            => new ActiveStatementTagger(_threadingContext, buffer) as ITagger<T>;
33 34
    }
}