提交 e49f1ab4 编写于 作者: A Ankita Khera

trying to get colors to change

上级 96f230cd
......@@ -6,11 +6,16 @@
using System.ComponentModel.Composition;
using System.Windows.Media;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Language.StandardClassification;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
{
[Export(typeof(EditorFormatDefinition))]
[Name(InlineParameterNameHintsTag.TagId)]
[Order(After = LanguagePriority.NaturalLanguage, Before = LanguagePriority.FormalLanguage)]
[UserVisible(true)]
internal sealed class InlineParameterNameHintsFormatDefinition : EditorFormatDefinition
{
[ImportingConstructor]
......
......@@ -18,6 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints
/// </summary>
internal class InlineParameterNameHintsTag : IntraTextAdornmentTag
{
public const string TagId = "inline parameter name hints";
/// <summary>
/// Creates the UIElement on call
/// Uses PositionAffinity.Successor because we want the tag to be associated with the following character
......@@ -41,15 +42,15 @@ private static UIElement CreateElement(string text, double lineHeight, TextForma
FontFamily = format.Typeface.FontFamily, //new System.Windows.Media.FontFamily("Consolas"),
FontSize = format.FontRenderingEmSize - 1,
Padding = new Thickness(0),
Background = System.Windows.Media.Brushes.Lavender,
Foreground = System.Windows.Media.Brushes.Gray
Background = format.BackgroundBrush,//System.Windows.Media.Brushes.Lavender,
Foreground = format.ForegroundBrush //System.Windows.Media.Brushes.Gray
};
var border = new Border
{
CornerRadius = new CornerRadius(2),
Background = System.Windows.Media.Brushes.Lavender,
BorderBrush = System.Windows.Media.Brushes.Lavender,
Background = format.BackgroundBrush,//System.Windows.Media.Brushes.Lavender,
BorderBrush = format.BackgroundBrush, //System.Windows.Media.Brushes.Lavender,
BorderThickness = new Thickness(1),
VerticalAlignment = VerticalAlignment.Center,
Height = lineHeight,
......
......@@ -28,6 +28,7 @@ internal sealed class InlineParameterNameHintsTagger : ITagger<IntraTextAdornmen
private ITextSnapshot _cacheSnapshot;
private readonly IClassificationFormatMap _formatMap;
private TextFormattingRunProperties _format;
private readonly IClassificationType _keyword;
public event EventHandler<SnapshotSpanEventArgs> TagsChanged;
......@@ -38,6 +39,7 @@ public InlineParameterNameHintsTagger(InlineParameterNameHintsTaggerProvider tag
_buffer = buffer;
_tagAggregator = tagAggregator;
_formatMap = taggerProvider.ClassificationFormatMapService.GetClassificationFormatMap(textView);
_keyword = taggerProvider.ClassificationTypeRegistryService.GetClassificationType(InlineParameterNameHintsTag.TagId);
_formatMap.ClassificationFormatMappingChanged += this.OnClassificationFormatMappingChanged;
_format = _formatMap.DefaultTextProperties;
_tagAggregator.TagsChanged += OnTagAggregatorTagsChanged;
......@@ -67,7 +69,7 @@ private TextFormattingRunProperties Format
get
{
if (_format == null)
_format = _formatMap.DefaultTextProperties;
_format = _formatMap.GetTextProperties(_keyword);
return _format;
}
......
......@@ -25,13 +25,17 @@ internal class InlineParameterNameHintsTaggerProvider : IViewTaggerProvider
{
private readonly IBufferTagAggregatorFactoryService _bufferTagAggregatorFactoryService;
public readonly IClassificationFormatMapService ClassificationFormatMapService;
public readonly IClassificationTypeRegistryService ClassificationTypeRegistryService;
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public InlineParameterNameHintsTaggerProvider(IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, [Import] IClassificationFormatMapService classificationFormatMapService)
public InlineParameterNameHintsTaggerProvider(IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService,
[Import] IClassificationFormatMapService classificationFormatMapService,
[Import] IClassificationTypeRegistryService classificationTypeRegistryService)
{
_bufferTagAggregatorFactoryService = bufferTagAggregatorFactoryService;
this.ClassificationFormatMapService = classificationFormatMapService;
this.ClassificationTypeRegistryService = classificationTypeRegistryService;
}
/*
......
......@@ -63,6 +63,10 @@
</Color>
<Color Name="label name">
</Color>
<Color Name="inline parameter name hints">
<Foreground Type="CT_RAW" Source="FF808080" />
<Background Type="CT_RAW" Source="FFE6E6FA" />
</Color>
<Color Name="xml doc comment - attribute name">
<Foreground Type="CT_RAW" Source="FF808080" />
</Color>
......@@ -214,6 +218,10 @@
</Color>
<Color Name="label name">
</Color>
<Color Name="inline parameter name hints">
<Foreground Type="CT_RAW" Source="FF808080" />
<Background Type="CT_RAW" Source="FFE6E6FA" />
</Color>
<Color Name="xml doc comment - attribute name">
<Foreground Type="CT_RAW" Source="FF808080" />
</Color>
......
......@@ -69,6 +69,10 @@
</Color>
<Color Name="label name">
</Color>
<Color Name="inline parameter name hints">
<Foreground Type="CT_RAW" Source="FF808080" />
<Background Type="CT_RAW" Source="FFE6E6FA" />
</Color>
<Color Name="xml doc comment - attribute name">
<Foreground Type="CT_RAW" Source="FF808080" />
</Color>
......@@ -226,6 +230,10 @@
</Color>
<Color Name="label name">
</Color>
<Color Name="inline parameter name hints">
<Foreground Type="CT_RAW" Source="FF808080" />
<Background Type="CT_RAW" Source="FFE6E6FA" />
</Color>
<Color Name="xml doc comment - attribute name">
<Foreground Type="CT_RAW" Source="FF808080" />
</Color>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册