From fd9a5f808b4982f7595e232beb5e6f508a9bb8f8 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 31 Aug 2021 15:42:25 -0700 Subject: [PATCH 1/2] #nullable enable a bit of the rename dashboard --- .../InlineRename/Dashboard/DashboardAdornmentManager.cs | 4 +--- .../InlineRename/Dashboard/DashboardAdornmentProvider.cs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentManager.cs b/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentManager.cs index 3ae7ef9e9af79..1ce59d0756f1a 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentManager.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentManager.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Linq; using System.Runtime.CompilerServices; @@ -75,7 +73,7 @@ private static bool ViewIncludesBufferFromWorkspace(IWpfTextView textView, Works .Any(); } - private static Workspace GetWorkspace(SourceTextContainer textContainer) + private static Workspace? GetWorkspace(SourceTextContainer textContainer) { Workspace.TryGetWorkspace(textContainer, out var workspace); return workspace; diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentProvider.cs b/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentProvider.cs index a178abce22309..38fba9146b530 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentProvider.cs +++ b/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardAdornmentProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.ObjectModel; using System.ComponentModel.Composition; @@ -36,7 +34,7 @@ internal class DashboardAdornmentProvider : IWpfTextViewConnectionListener [Order(After = PredefinedAdornmentLayers.TextMarker)] [Order(After = PredefinedAdornmentLayers.CurrentLineHighlighter)] [Order(After = PredefinedAdornmentLayers.Squiggle)] - internal readonly AdornmentLayerDefinition AdornmentLayer; + internal readonly AdornmentLayerDefinition? AdornmentLayer; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] From 074fe49d50ae7c0d44404af1b517cdd1045ebaf4 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Tue, 31 Aug 2021 15:46:24 -0700 Subject: [PATCH 2/2] Don't reference VS Shell binaries in EditorFeatures.Wpf EditorFeatures.Wpf is supposed to be independent of the VS Shell, the idea is this layer can be hosted in other applications using the VS editor but not VS itself. This re-adds indirection for fetching the dashboard colors, but now only does it when the dashboard is opened. While I was here I ended up renaming CodeAnalysisColors to DashboardColors which is a bit clearer what it is. --- .../Core.Wpf/CodeAnalysisColors.cs | 20 ----------- .../InlineRename/Dashboard/Dashboard.xaml | 14 ++++---- .../Dashboard/DashboardAdornmentManager.cs | 6 ++++ .../Dashboard/DashboardAdornmentProvider.cs | 8 +++-- .../InlineRename/Dashboard/DashboardColors.cs | 24 ++++++++++++++ .../{Colors.xaml => DashboardColors.xaml} | 4 +++ .../Dashboard/IDashboardColorUpdater.cs | 14 ++++++++ ...oft.CodeAnalysis.EditorFeatures.Wpf.csproj | 2 -- .../InlineRename/DashboardColorUpdater.cs | 33 +++++++++++++++++++ 9 files changed, 93 insertions(+), 32 deletions(-) delete mode 100644 src/EditorFeatures/Core.Wpf/CodeAnalysisColors.cs create mode 100644 src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/DashboardColors.cs rename src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/{Colors.xaml => DashboardColors.xaml} (67%) create mode 100644 src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/IDashboardColorUpdater.cs create mode 100644 src/VisualStudio/Core/Def/Implementation/InlineRename/DashboardColorUpdater.cs diff --git a/src/EditorFeatures/Core.Wpf/CodeAnalysisColors.cs b/src/EditorFeatures/Core.Wpf/CodeAnalysisColors.cs deleted file mode 100644 index 50fba1f95cbcd..0000000000000 --- a/src/EditorFeatures/Core.Wpf/CodeAnalysisColors.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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. - -using Microsoft.VisualStudio.PlatformUI; -using Microsoft.VisualStudio.Shell; - -namespace Microsoft.CodeAnalysis.Editor.Shared.Utilities -{ - internal static class CodeAnalysisColors - { - // Use VS color keys in order to support theming. - public static object SystemCaptionTextColorKey => EnvironmentColors.SystemWindowTextColorKey; - public static object CheckBoxTextBrushKey => EnvironmentColors.SystemWindowTextBrushKey; - public static object SystemCaptionTextBrushKey => EnvironmentColors.SystemWindowTextBrushKey; - public static object BackgroundBrushKey => VsBrushes.CommandBarGradientBeginKey; - public static object ButtonStyleKey => VsResourceKeys.ButtonStyleKey; - public static object AccentBarColorKey => EnvironmentColors.FileTabInactiveDocumentBorderEdgeBrushKey; - } -} diff --git a/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/Dashboard.xaml b/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/Dashboard.xaml index a9bc286f46dd5..18c0b5beaba69 100644 --- a/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/Dashboard.xaml +++ b/src/EditorFeatures/Core.Wpf/InlineRename/Dashboard/Dashboard.xaml @@ -4,11 +4,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:me="clr-namespace:Microsoft.CodeAnalysis.Editor" xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging" xmlns:imagecatalog="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.ImageCatalog" xmlns:rename="clr-namespace:Microsoft.CodeAnalysis.Editor.Implementation.InlineRename" - xmlns:utilities="clr-namespace:Microsoft.CodeAnalysis.Editor.Shared.Utilities" x:ClassModifier="internal" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" MinWidth="300" @@ -26,15 +24,15 @@ - + - +