提交 73a50745 编写于 作者: D David Poeschl 提交者: GitHub

Merge pull request #20222 from dpoeschl/InlineRenameTaggingAccessibility

Accessibility for Inline Rename in the Editor
......@@ -162,6 +162,8 @@
<Compile Include="FindUsages\IFindUsagesService.cs" />
<Compile Include="FindUsages\SimpleFindUsagesContext.cs" />
<Compile Include="Implementation\InlineRename\Dashboard\DashboardAutomationPeer.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\RenameConflictTag.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\RenameConflictTagDefinition.cs" />
<Compile Include="Implementation\Intellisense\QuickInfo\Providers\LinkedFileDiscrepancyException.cs" />
<Compile Include="Implementation\Intellisense\Completion\CompletionFilterReason.cs" />
<Compile Include="Implementation\Intellisense\Completion\FilterResult.cs" />
......@@ -511,10 +513,10 @@
<Compile Include="Implementation\InlineRename\Dashboard\DashboardSeverity.cs" />
<Compile Include="Implementation\InlineRename\Dashboard\DashboardViewModel.cs" />
<Compile Include="Implementation\InlineRename\Dashboard\RenameShortcutKeys.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\FixupTag.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\FixupTagDefinition.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\ValidTag.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\ValidTagDefinition.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\RenameFixupTag.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\RenameFixupTagDefinition.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\RenameFieldBackgroundAndBorderTag.cs" />
<Compile Include="Implementation\InlineRename\HighlightTags\RenameFieldBackgroundAndBorderTagDefinition.cs" />
<Compile Include="Implementation\InlineRename\IEditorInlineRenameService.cs" />
<Compile Include="Implementation\InlineRename\InlineRenameService.cs" />
<Compile Include="Implementation\InlineRename\InlineRenameSession.cs" />
......
......@@ -19,7 +19,7 @@ namespace Microsoft.CodeAnalysis.Editor {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class EditorFeaturesResources {
......@@ -935,6 +935,33 @@ internal class EditorFeaturesResources {
}
}
/// <summary>
/// Looks up a localized string similar to Inline Rename Conflict.
/// </summary>
internal static string Inline_Rename_Conflict {
get {
return ResourceManager.GetString("Inline_Rename_Conflict", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Inline Rename Field Background and Border.
/// </summary>
internal static string Inline_Rename_Field_Background_and_Border {
get {
return ResourceManager.GetString("Inline_Rename_Field_Background_and_Border", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Inline Rename Field Text.
/// </summary>
internal static string Inline_Rename_Field_Text {
get {
return ResourceManager.GetString("Inline_Rename_Field_Text", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Inline Rename Fixup.
/// </summary>
......
......@@ -758,4 +758,13 @@ Do you want to proceed?</value>
<value>An inline rename session is active</value>
<comment>For screenreaders</comment>
</data>
<data name="Inline_Rename_Conflict" xml:space="preserve">
<value>Inline Rename Conflict</value>
</data>
<data name="Inline_Rename_Field_Background_and_Border" xml:space="preserve">
<value>Inline Rename Field Background and Border</value>
</data>
<data name="Inline_Rename_Field_Text" xml:space="preserve">
<value>Inline Rename Field Text</value>
</data>
</root>
\ No newline at end of file
......@@ -5,8 +5,6 @@
<Color x:Key="SystemCaptionTextColor">Black</Color>
<SolidColorBrush x:Key="SystemCaptionTextBrush" Color="Black"/>
<SolidColorBrush x:Key="CheckBoxTextBrush" Color="Black"/>
<SolidColorBrush x:Key="RenameResolvableConflictTextBrush" Color="Green"/>
<SolidColorBrush x:Key="RenameErrorTextBrush">Red</SolidColorBrush>
<SolidColorBrush x:Key="BackgroundBrush">LightGray</SolidColorBrush>
<SolidColorBrush x:Key="AccentBarBrush">Blue</SolidColorBrush>
<Style TargetType="Button" x:Key="ButtonStyle" BasedOn="{StaticResource {x:Type Button}}"/>
......
......@@ -102,20 +102,7 @@
MaxWidth="260"
VerticalAlignment="Center"
HorizontalAlignment="Left"
ToolTip="{Binding Session.OriginalSymbolName, Mode=OneTime}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource ForegroundText}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Severity}" Value="Error">
<Setter Property="Foreground" Value="{DynamicResource {x:Static utilities:CodeAnalysisColors.RenameErrorTextBrushKey}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
ToolTip="{Binding Session.OriginalSymbolName, Mode=OneTime}"/>
<Button
Name="CloseButton"
Grid.Row ="0"
......@@ -179,10 +166,9 @@
</Style.Triggers>
</Style>
</StackPanel.Style>
<TextBlock Text="{Binding Path=ResolvableConflictText}" Foreground="{DynamicResource {x:Static utilities:CodeAnalysisColors.RenameResolvableConflictTextBrushKey}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Grid>
<Grid.Style>
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
......@@ -191,12 +177,22 @@
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Text="{Binding Path=UnresolvableConflictText}" Foreground="{DynamicResource {x:Static utilities:CodeAnalysisColors.RenameErrorTextBrushKey}}" FontWeight="Bold">
<TextBlock.Style>
<Style TargetType="TextBlock">
</Grid.Style>
<Rectangle Name="ResolvableConflictBorder"
Width="{Binding ElementName=ResolvableConflictText, Path=ActualWidth}"
Height="{Binding ElementName=ResolvableConflictText, Path=ActualHeight}"
VerticalAlignment="Top"
HorizontalAlignment="Left"/>
<TextBlock Name="ResolvableConflictText"
Text="{Binding Path=ResolvableConflictText}"
Padding="4 2 4 4"
VerticalAlignment="Top"
HorizontalAlignment="Left"/>
</Grid>
<Grid Margin="0 4 0 0">
<Grid.Style>
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
......@@ -205,10 +201,22 @@
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Text="{Binding Path=ErrorText}" Foreground="{DynamicResource {x:Static utilities:CodeAnalysisColors.RenameErrorTextBrushKey}}" FontWeight="Bold">
</Grid.Style>
<Rectangle Name="UnresolvableConflictBorder"
Width="{Binding ElementName=UnresolvableConflictText, Path=ActualWidth}"
Height="{Binding ElementName=UnresolvableConflictText, Path=ActualHeight}"
VerticalAlignment="Top"
HorizontalAlignment="Left"/>
<TextBlock Name="UnresolvableConflictText"
Text="{Binding Path=UnresolvableConflictText}"
Padding="4 2 4 4"
VerticalAlignment="Top"
HorizontalAlignment="Left"/>
</Grid>
<TextBlock Name="ErrorText"
Text="{Binding Path=ErrorText}"
Margin="0 4 0 0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
......
......@@ -7,6 +7,9 @@
using System.Windows.Automation.Peers;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
......@@ -21,6 +24,8 @@ internal partial class Dashboard : UserControl, IDisposable
private IInputElement _rootInputElement;
private UIElement _focusedElement = null;
private readonly List<UIElement> _tabNavigableChildren;
private readonly IEditorFormatMap _textFormattingMap;
internal bool ShouldReceiveKeyboardNavigation { get; set; }
private IEnumerable<string> _renameAccessKeys = new[]
......@@ -34,6 +39,7 @@ internal partial class Dashboard : UserControl, IDisposable
public Dashboard(
DashboardViewModel model,
IEditorFormatMapService editorFormatMapService,
IWpfTextView textView)
{
_model = model;
......@@ -69,11 +75,43 @@ internal partial class Dashboard : UserControl, IDisposable
// for us to set up the AutomationPeer
this.Loaded += Dashboard_Loaded;
if (editorFormatMapService != null)
{
_textFormattingMap = editorFormatMapService.GetEditorFormatMap("text");
_textFormattingMap.FormatMappingChanged += UpdateBorderColors;
UpdateBorderColors(this, eventArgs: null);
}
ResolvableConflictBorder.StrokeThickness = RenameFixupTagDefinition.StrokeThickness;
ResolvableConflictBorder.StrokeDashArray = new DoubleCollection(RenameFixupTagDefinition.StrokeDashArray);
UnresolvableConflictBorder.StrokeThickness = RenameConflictTagDefinition.StrokeThickness;
UnresolvableConflictBorder.StrokeDashArray = new DoubleCollection(RenameConflictTagDefinition.StrokeDashArray);
this.Focus();
textView.Caret.IsHidden = false;
ShouldReceiveKeyboardNavigation = false;
}
private void UpdateBorderColors(object sender, FormatItemsEventArgs eventArgs)
{
var resolvableConflictBrush = GetEditorTagBorderBrush(RenameFixupTag.TagId);
ResolvableConflictBorder.Stroke = resolvableConflictBrush;
ResolvableConflictText.Foreground = resolvableConflictBrush;
var unresolvableConflictBrush = GetEditorTagBorderBrush(RenameConflictTag.TagId);
UnresolvableConflictBorder.Stroke = unresolvableConflictBrush;
UnresolvableConflictText.Foreground = unresolvableConflictBrush;
ErrorText.Foreground = unresolvableConflictBrush;
}
private Brush GetEditorTagBorderBrush(string tagId)
{
var properties = _textFormattingMap.GetProperties(tagId);
return (Brush)(properties["Foreground"] ?? ((Pen)properties["MarkerFormatDefinition/BorderId"]).Brush);
}
private void Dashboard_Loaded(object sender, RoutedEventArgs e)
{
// Move automation focus to the Dashboard so that screenreaders will announce that the
......@@ -294,6 +332,11 @@ public void Dispose()
((UIElement)_findAdornmentLayer).LayoutUpdated -= FindAdornmentCanvas_LayoutUpdated;
}
if (_textFormattingMap != null)
{
_textFormattingMap.FormatMappingChanged -= UpdateBorderColors;
}
this.Loaded -= Dashboard_Loaded;
_model.Dispose();
......
......@@ -5,6 +5,7 @@
using System.Runtime.CompilerServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
......@@ -13,14 +14,19 @@ internal class DashboardAdornmentManager : IDisposable
{
private readonly IWpfTextView _textView;
private readonly InlineRenameService _renameService;
private readonly IEditorFormatMapService _editorFormatMapService;
private readonly IAdornmentLayer _adornmentLayer;
private static readonly ConditionalWeakTable<InlineRenameSession, DashboardViewModel> s_createdViewModels =
new ConditionalWeakTable<InlineRenameSession, DashboardViewModel>();
public DashboardAdornmentManager(InlineRenameService renameService, IWpfTextView textView)
public DashboardAdornmentManager(
InlineRenameService renameService,
IEditorFormatMapService editorFormatMapService,
IWpfTextView textView)
{
_renameService = renameService;
_editorFormatMapService = editorFormatMapService;
_textView = textView;
_adornmentLayer = textView.GetAdornmentLayer(DashboardAdornmentProvider.AdornmentLayerName);
......@@ -54,7 +60,10 @@ private void UpdateAdornments()
if (_renameService.ActiveSession != null &&
ViewIncludesBufferFromWorkspace(_textView, _renameService.ActiveSession.Workspace))
{
var newAdornment = new Dashboard(s_createdViewModels.GetValue(_renameService.ActiveSession, session => new DashboardViewModel(session)), _textView);
var newAdornment = new Dashboard(
s_createdViewModels.GetValue(_renameService.ActiveSession, session => new DashboardViewModel(session)),
_editorFormatMapService,
_textView);
_adornmentLayer.AddAdornment(AdornmentPositioningBehavior.ViewportRelative, null, null, newAdornment,
(tag, adornment) => ((Dashboard)adornment).Dispose());
}
......
......@@ -5,6 +5,7 @@
using System.Linq;
using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Utilities;
......@@ -17,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
internal class DashboardAdornmentProvider : IWpfTextViewConnectionListener
{
private readonly InlineRenameService _renameService;
private readonly IEditorFormatMapService _editorFormatMapService;
public const string AdornmentLayerName = "RoslynRenameDashboard";
[Export]
......@@ -33,15 +34,17 @@ internal class DashboardAdornmentProvider : IWpfTextViewConnectionListener
[ImportingConstructor]
public DashboardAdornmentProvider(
InlineRenameService renameService)
InlineRenameService renameService,
IEditorFormatMapService editorFormatMapService)
{
_renameService = renameService;
_editorFormatMapService = editorFormatMapService;
}
public void SubjectBuffersConnected(IWpfTextView textView, ConnectionReason reason, Collection<ITextBuffer> subjectBuffers)
{
// Create it for the view if we don't already have one
textView.GetOrCreateAutoClosingProperty(v => new DashboardAdornmentManager(_renameService, v));
textView.GetOrCreateAutoClosingProperty(v => new DashboardAdornmentManager(_renameService, _editorFormatMapService, v));
}
public void SubjectBuffersDisconnected(IWpfTextView textView, ConnectionReason reason, Collection<ITextBuffer> subjectBuffers)
......
......@@ -4,13 +4,14 @@
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags
{
internal class ValidTag : TextMarkerTag
internal class RenameConflictTag : TextMarkerTag
{
internal const string TagId = "RoslynRenameValidTag";
// Only used for theming, does not need localized
internal const string TagId = "RoslynRenameConflictTag";
public static readonly ValidTag Instance = new ValidTag();
public static readonly RenameConflictTag Instance = new RenameConflictTag();
private ValidTag()
private RenameConflictTag()
: base(TagId)
{
}
......
......@@ -9,17 +9,19 @@
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags
{
[Export(typeof(EditorFormatDefinition))]
[Name(ValidTag.TagId)]
[Name(RenameConflictTag.TagId)]
[UserVisible(true)]
[ExcludeFromCodeCoverage]
internal class ValidTagDefinition : MarkerFormatDefinition
internal class RenameConflictTagDefinition : MarkerFormatDefinition
{
public ValidTagDefinition()
public static double StrokeThickness => 1.5;
public static double[] StrokeDashArray => new[] { 8.0, 4.0 };
public RenameConflictTagDefinition()
{
this.Border = new Pen(Brushes.LightGreen, thickness: 0.5);
this.BackgroundColor = Colors.LightGreen;
this.DisplayName = EditorFeaturesResources.Inline_Rename;
this.ZOrder = 5;
this.Border = new Pen(Brushes.Red, thickness: StrokeThickness) { DashStyle = new DashStyle(StrokeDashArray, 0) };
this.DisplayName = EditorFeaturesResources.Inline_Rename_Conflict;
this.ZOrder = 10;
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags
{
internal class RenameFieldBackgroundAndBorderTag : TextMarkerTag
{
// Only used for theming, does not need localized
internal const string TagId = "RoslynRenameFieldBackgroundAndBorderTag";
public static readonly RenameFieldBackgroundAndBorderTag Instance = new RenameFieldBackgroundAndBorderTag();
private RenameFieldBackgroundAndBorderTag()
: base(TagId)
{
}
}
// Only used to keep the closed repository building. This will be removed once the
// closed repository is updated to use RenameFieldBackgroundAndBorderTag.
internal class ValidTag
{
internal const string TagId = "";
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel.Composition;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Media;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags
{
[Export(typeof(EditorFormatDefinition))]
[Name(RenameFieldBackgroundAndBorderTag.TagId)]
[UserVisible(true)]
[ExcludeFromCodeCoverage]
internal class RenameFieldBackgroundAndBorderTagDefinition : MarkerFormatDefinition
{
public RenameFieldBackgroundAndBorderTagDefinition()
{
// The Border color should match the BackgroundColor from the
// InlineRenameFieldFormatDefinition.
this.Border = new Pen(new SolidColorBrush(Color.FromRgb(0xFF, 0xFF, 0xFF)), thickness: 2.0);
this.BackgroundColor = Color.FromRgb(0xA6, 0xF1, 0xA6);
this.DisplayName = EditorFeaturesResources.Inline_Rename_Field_Background_and_Border;
// Needs to show above highlight references, but below the resolved/unresolved rename
// conflict tags.
this.ZOrder = 1;
}
}
}
......@@ -4,13 +4,14 @@
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags
{
internal class FixupTag : TextMarkerTag
internal class RenameFixupTag : TextMarkerTag
{
// Only used for theming, does not need localized
internal const string TagId = "RoslynRenameFixupTag";
public static readonly FixupTag Instance = new FixupTag();
public static readonly RenameFixupTag Instance = new RenameFixupTag();
private FixupTag()
private RenameFixupTag()
: base(TagId)
{
}
......
......@@ -9,14 +9,17 @@
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags
{
[Export(typeof(EditorFormatDefinition))]
[Name(FixupTag.TagId)]
[Name(RenameFixupTag.TagId)]
[UserVisible(true)]
[ExcludeFromCodeCoverage]
internal class FixupTagDefinition : MarkerFormatDefinition
internal class RenameFixupTagDefinition : MarkerFormatDefinition
{
public FixupTagDefinition()
public static double StrokeThickness => 1.0;
public static double[] StrokeDashArray => new[] { 4.0, 4.0 };
public RenameFixupTagDefinition()
{
this.Border = new Pen(Brushes.Green, thickness: 1.0) { DashStyle = new DashStyle(new[] { 4.0, 4.0 }, 0) };
this.Border = new Pen(Brushes.Green, thickness: StrokeThickness) { DashStyle = new DashStyle(StrokeDashArray, 0) };
this.DisplayName = EditorFeaturesResources.Inline_Rename_Fixup;
this.ZOrder = 1;
}
......
......@@ -8,12 +8,10 @@
namespace Microsoft.CodeAnalysis.Editor.Implementation.InlineRename
{
// This class is necessary so that our rename colors work on the
// dark theme as well. Otherwise the default white identifier
// foreground color clashes with our light green background.
internal sealed class ClassificationTypeDefinitions
{
public const string InlineRenameField = "inline rename field";
// Only used for theming, does not need localized
public const string InlineRenameField = "Inline Rename Field Text";
[Export]
[Name(InlineRenameField)]
......@@ -24,13 +22,13 @@ internal sealed class ClassificationTypeDefinitions
[ClassificationType(ClassificationTypeNames = InlineRenameField)]
[Name(InlineRenameField)]
[Order(After = Priority.High)]
[UserVisible(false)]
[UserVisible(true)]
private class InlineRenameFieldFormatDefinition : ClassificationFormatDefinition
{
private InlineRenameFieldFormatDefinition()
{
this.DisplayName = EditorFeaturesResources.Inline_Rename;
this.ForegroundColor = Color.FromRgb(0, 100, 0);
this.DisplayName = EditorFeaturesResources.Inline_Rename_Field_Text;
this.ForegroundColor = Color.FromRgb(0x00, 0x64, 0x00);
}
}
}
......
......@@ -21,13 +21,13 @@ protected override bool TryCreateTagSpan(SnapshotSpan span, RenameSpanKind type,
switch (type)
{
case RenameSpanKind.Reference:
tagKind = ValidTag.Instance;
tagKind = RenameFieldBackgroundAndBorderTag.Instance;
break;
case RenameSpanKind.UnresolvedConflict:
tagKind = ConflictTag.Instance;
tagKind = RenameConflictTag.Instance;
break;
case RenameSpanKind.Complexified:
tagKind = FixupTag.Instance;
tagKind = RenameFixupTag.Instance;
break;
default:
throw ExceptionUtilities.UnexpectedValue(type);
......
......@@ -6,8 +6,6 @@ internal static class CodeAnalysisColors
{
private static object s_systemCaptionTextColorKey = "SystemCaptionTextColor";
private static object s_checkBoxTextBrushKey = "CheckboxTextBrush";
private static object s_renameResolvableConflictTextBrushKey = "RenameResolvableConflictTextBrush";
private static object s_renameErrorTextBrushKey = "RenameErrorTextBrush";
private static object s_systemCaptionTextBrushKey = "SystemCaptionTextBrush";
private static object s_backgroundBrushKey = "BackgroundBrush";
private static object s_buttonStyleKey = "ButtonStyle";
......@@ -52,32 +50,6 @@ public static object CheckBoxTextBrushKey
}
}
public static object RenameResolvableConflictTextBrushKey
{
get
{
return s_renameResolvableConflictTextBrushKey;
}
set
{
s_renameResolvableConflictTextBrushKey = value;
}
}
public static object RenameErrorTextBrushKey
{
get
{
return s_renameErrorTextBrushKey;
}
set
{
s_renameErrorTextBrushKey = value;
}
}
public static object BackgroundBrushKey
{
get
......
......@@ -592,7 +592,11 @@ class D : B
Dim listeners = DirectCast(workspace.ExportProvider.GetExports(Of IAsynchronousOperationListener, FeatureMetadata)(), IEnumerable(Of Lazy(Of IAsynchronousOperationListener, FeatureMetadata)))
Dim renameListener = New AggregateAsynchronousOperationListener(listeners, FeatureAttribute.Rename)
Using dashboard = New Dashboard(New DashboardViewModel(DirectCast(sessionInfo.Session, InlineRenameSession)), cursorDocument.GetTextView())
Using dashboard = New Dashboard(
New DashboardViewModel(DirectCast(sessionInfo.Session, InlineRenameSession)),
editorFormatMapService:=Nothing,
textView:=cursorDocument.GetTextView())
Await WaitForRename(workspace)
Dim model = DirectCast(dashboard.DataContext, DashboardViewModel)
......
......@@ -55,10 +55,10 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename
Private Async Function VerifySpansBeforeConflictResolution(actualWorkspace As TestWorkspace, renameService As InlineRenameService) As Task
' Verify no fixup/resolved non-reference conflict span.
Await VerifyEmptyTaggedSpans(HighlightTags.FixupTag.Instance, actualWorkspace, renameService)
Await VerifyEmptyTaggedSpans(HighlightTags.RenameFixupTag.Instance, actualWorkspace, renameService)
' Verify valid reference tags.
Await VerifyTaggedSpans(HighlightTags.ValidTag.Instance, actualWorkspace, renameService)
Await VerifyTaggedSpans(HighlightTags.RenameFieldBackgroundAndBorderTag.Instance, actualWorkspace, renameService)
End Function
Private Async Function VerifySpansAndBufferForConflictResolution(actualWorkspace As TestWorkspace, renameService As InlineRenameService, resolvedConflictWorkspace As TestWorkspace,
......@@ -66,10 +66,10 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename
Await WaitForRename(actualWorkspace)
' Verify fixup/resolved conflict spans.
Await VerifyAnnotatedTaggedSpans(HighlightTags.FixupTag.Instance, "Complexified", actualWorkspace, renameService, resolvedConflictWorkspace)
Await VerifyAnnotatedTaggedSpans(HighlightTags.RenameFixupTag.Instance, "Complexified", actualWorkspace, renameService, resolvedConflictWorkspace)
' Verify valid reference tags.
Await VerifyTaggedSpans(HighlightTags.ValidTag.Instance, actualWorkspace, renameService, resolvedConflictWorkspace)
Await VerifyTaggedSpans(HighlightTags.RenameFieldBackgroundAndBorderTag.Instance, actualWorkspace, renameService, resolvedConflictWorkspace)
VerifyBufferContentsInWorkspace(actualWorkspace, resolvedConflictWorkspace)
......@@ -126,7 +126,7 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Rename
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim session = StartSession(workspace)
Await VerifyTaggedSpans(HighlightTags.ValidTag.Instance, workspace, renameService)
Await VerifyTaggedSpans(HighlightTags.RenameFieldBackgroundAndBorderTag.Instance, workspace, renameService)
session.Cancel()
End Using
End Function
......@@ -183,7 +183,7 @@ class Program
Dim renamedDocument = renamedWorkspace.Documents.Single()
Dim expectedSpans = GetAnnotatedSpans("conflict", renamedDocument)
Dim taggedSpans = GetTagsOfType(ConflictTag.Instance, renameService, document.TextBuffer)
Dim taggedSpans = GetTagsOfType(RenameConflictTag.Instance, renameService, document.TextBuffer)
Assert.Equal(expectedSpans, taggedSpans)
End Using
End Using
......@@ -285,15 +285,15 @@ public class Class1
Dim renamedDocument = renamedWorkspace.Documents.First()
Dim expectedSpans = GetAnnotatedSpans("resolved", renamedDocument)
Dim taggedSpans = GetTagsOfType(FixupTag.Instance, renameService, document.TextBuffer)
Dim taggedSpans = GetTagsOfType(RenameFixupTag.Instance, renameService, document.TextBuffer)
Assert.Equal(expectedSpans, taggedSpans)
expectedSpans = GetAnnotatedSpans("conflict", renamedDocument)
taggedSpans = GetTagsOfType(ConflictTag.Instance, renameService, document.TextBuffer)
taggedSpans = GetTagsOfType(RenameConflictTag.Instance, renameService, document.TextBuffer)
Assert.Equal(expectedSpans, taggedSpans)
expectedSpans = GetAnnotatedSpans("valid", renamedDocument)
taggedSpans = GetTagsOfType(ValidTag.Instance, renameService, document.TextBuffer)
taggedSpans = GetTagsOfType(RenameFieldBackgroundAndBorderTag.Instance, renameService, document.TextBuffer)
Assert.Equal(expectedSpans, taggedSpans)
End Using
End Using
......@@ -367,7 +367,7 @@ public class Class1
Dim renamedDocument = renamedWorkspace.Documents.First()
Dim expectedSpans = GetAnnotatedSpans("conflict", renamedDocument)
Dim taggedSpans = GetTagsOfType(ConflictTag.Instance, renameService, document.TextBuffer)
Dim taggedSpans = GetTagsOfType(RenameConflictTag.Instance, renameService, document.TextBuffer)
Assert.Equal(expectedSpans, taggedSpans)
End Using
End Using
......@@ -404,7 +404,7 @@ public class Class1
Dim conflictDocument = workspace.Documents.Single(Function(d) d.FilePath = "B.cs")
Dim expectedSpans = GetAnnotatedSpans("conflict", conflictDocument)
Dim taggedSpans = GetTagsOfType(ConflictTag.Instance, renameService, conflictDocument.TextBuffer)
Dim taggedSpans = GetTagsOfType(RenameConflictTag.Instance, renameService, conflictDocument.TextBuffer)
Assert.Equal(expectedSpans, taggedSpans)
End Using
End Function
......@@ -1605,10 +1605,10 @@ static class E
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim session = StartSession(workspace)
Dim validTaggedSpans = Await GetTagsOfType(HighlightTags.ValidTag.Instance, workspace, renameService)
Dim validTaggedSpans = Await GetTagsOfType(HighlightTags.RenameFieldBackgroundAndBorderTag.Instance, workspace, renameService)
Dim validExpectedSpans = workspace.Documents.Single(Function(d) d.AnnotatedSpans.Count > 0).AnnotatedSpans("valid").Select(Function(ts) ts.ToSpan())
Dim conflictTaggedSpans = Await GetTagsOfType(ConflictTag.Instance, workspace, renameService)
Dim conflictTaggedSpans = Await GetTagsOfType(RenameConflictTag.Instance, workspace, renameService)
Dim conflictExpectedSpans = workspace.Documents.Single(Function(d) d.AnnotatedSpans.Count > 0).AnnotatedSpans("conflict").Select(Function(ts) ts.ToSpan())
session.Cancel()
......@@ -1639,10 +1639,10 @@ static class E
Dim renameService = workspace.GetService(Of InlineRenameService)()
Dim session = StartSession(workspace)
Dim validTaggedSpans = Await GetTagsOfType(HighlightTags.ValidTag.Instance, workspace, renameService)
Dim validTaggedSpans = Await GetTagsOfType(HighlightTags.RenameFieldBackgroundAndBorderTag.Instance, workspace, renameService)
Dim validExpectedSpans = workspace.Documents.Single(Function(d) d.AnnotatedSpans.Count > 0).AnnotatedSpans("valid").Select(Function(ts) ts.ToSpan())
Dim conflictTaggedSpans = Await GetTagsOfType(ConflictTag.Instance, workspace, renameService)
Dim conflictTaggedSpans = Await GetTagsOfType(RenameConflictTag.Instance, workspace, renameService)
Dim conflictExpectedSpans = workspace.Documents.Single(Function(d) d.AnnotatedSpans.Count > 0).AnnotatedSpans("conflict").Select(Function(ts) ts.ToSpan())
session.Cancel()
......
......@@ -91,8 +91,6 @@ private void InitializeColors()
CodeAnalysisColors.SystemCaptionTextColorKey = EnvironmentColors.SystemWindowTextColorKey;
CodeAnalysisColors.SystemCaptionTextBrushKey = EnvironmentColors.SystemWindowTextBrushKey;
CodeAnalysisColors.CheckBoxTextBrushKey = EnvironmentColors.SystemWindowTextBrushKey;
CodeAnalysisColors.RenameErrorTextBrushKey = VSCodeAnalysisColors.RenameErrorTextBrushKey;
CodeAnalysisColors.RenameResolvableConflictTextBrushKey = VSCodeAnalysisColors.RenameResolvableConflictTextBrushKey;
CodeAnalysisColors.BackgroundBrushKey = VsBrushes.CommandBarGradientBeginKey;
CodeAnalysisColors.ButtonStyleKey = VsResourceKeys.ButtonStyleKey;
CodeAnalysisColors.AccentBarColorKey = EnvironmentColors.FileTabInactiveDocumentBorderEdgeBrushKey;
......
......@@ -199,7 +199,6 @@
<Compile Include="Telemetry\VSTelemetryCache.cs" />
<Compile Include="Telemetry\VSTelemetryLogger.cs" />
<Compile Include="Utilities\IVsEditorAdaptersFactoryServiceExtensions.cs" />
<Compile Include="Utilities\VSCodeAnalysisColors.cs" />
<Compile Include="Implementation\WorkspaceCacheService.cs" />
<Compile Include="Implementation\Workspace\WorkspaceFailureOutputPane.cs" />
<Compile Include="Implementation\ProjectSystem\VisualStudioWorkspaceImpl.AbstractAddRemoveUndoUnit.cs" />
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.Shell;
namespace Microsoft.VisualStudio.LanguageServices.Utilities
{
internal static class VSCodeAnalysisColors
{
#region Autogenerated resource keys
// These resource keys are generated by VsThemeEditor, and should be replaced when new colors are added to this category.
public static readonly Guid Category = new Guid("bbadd5c0-3c00-4c56-aae8-92cd1d1f516b");
private static ThemeResourceKey s_renameErrorColorKey;
private static ThemeResourceKey s_renameErrorBrushKey;
private static ThemeResourceKey s_renameErrorTextColorKey;
private static ThemeResourceKey s_renameErrorTextBrushKey;
public static ThemeResourceKey RenameErrorColorKey { get { return s_renameErrorColorKey ?? (s_renameErrorColorKey = new ThemeResourceKey(Category, "RenameError", ThemeResourceKeyType.BackgroundColor)); } }
public static ThemeResourceKey RenameErrorBrushKey { get { return s_renameErrorBrushKey ?? (s_renameErrorBrushKey = new ThemeResourceKey(Category, "RenameError", ThemeResourceKeyType.BackgroundBrush)); } }
public static ThemeResourceKey RenameErrorTextColorKey { get { return s_renameErrorTextColorKey ?? (s_renameErrorTextColorKey = new ThemeResourceKey(Category, "RenameError", ThemeResourceKeyType.ForegroundColor)); } }
public static ThemeResourceKey RenameErrorTextBrushKey { get { return s_renameErrorTextBrushKey ?? (s_renameErrorTextBrushKey = new ThemeResourceKey(Category, "RenameError", ThemeResourceKeyType.ForegroundBrush)); } }
private static ThemeResourceKey s_renameResolvableConflictColorKey;
private static ThemeResourceKey s_renameResolvableConflictBrushKey;
private static ThemeResourceKey s_renameResolvableConflictTextColorKey;
private static ThemeResourceKey s_renameResolvableConflictTextBrushKey;
public static ThemeResourceKey RenameResolvableConflictColorKey { get { return s_renameResolvableConflictColorKey ?? (s_renameResolvableConflictColorKey = new ThemeResourceKey(Category, "RenameResolvableConflict", ThemeResourceKeyType.BackgroundColor)); } }
public static ThemeResourceKey RenameResolvableConflictBrushKey { get { return s_renameResolvableConflictBrushKey ?? (s_renameResolvableConflictBrushKey = new ThemeResourceKey(Category, "RenameResolvableConflict", ThemeResourceKeyType.BackgroundBrush)); } }
public static ThemeResourceKey RenameResolvableConflictTextColorKey { get { return s_renameResolvableConflictTextColorKey ?? (s_renameResolvableConflictTextColorKey = new ThemeResourceKey(Category, "RenameResolvableConflict", ThemeResourceKeyType.ForegroundColor)); } }
public static ThemeResourceKey RenameResolvableConflictTextBrushKey { get { return s_renameResolvableConflictTextBrushKey ?? (s_renameResolvableConflictTextBrushKey = new ThemeResourceKey(Category, "RenameResolvableConflict", ThemeResourceKeyType.ForegroundBrush)); } }
#endregion
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册