-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrayLogClassifierProvider.cs
More file actions
36 lines (31 loc) · 1.25 KB
/
Copy pathGrayLogClassifierProvider.cs
File metadata and controls
36 lines (31 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
namespace GrayLog
{
/// <summary>
/// Export a <see cref="IClassifierProvider"/>
/// </summary>
[Export(typeof(IClassifierProvider))]
[ContentType("code")]
internal class GrayLogClassifierProvider : IClassifierProvider
{
#pragma warning disable 0649 //"warning CS0649 : field is never assigned to"
[Export(typeof(ClassificationTypeDefinition))]
[Name("GrayLog")]
internal ClassificationTypeDefinition GrayLogClassificationType;
[Import]
internal IClassificationTypeRegistryService ClassificationRegistry;
[Import]
internal IBufferTagAggregatorFactoryService TagAggregatorFactory;
#pragma warning restore 0649
public IClassifier GetClassifier(ITextBuffer buffer)
{
IClassificationType classificationType = ClassificationRegistry.GetClassificationType("GrayLog");
var tagAggregator = TagAggregatorFactory.CreateTagAggregator<GrayLogTag>(buffer);
return new GrayLogClassifier(tagAggregator, classificationType);
}
}
}