From 6a8ff257cc1a6581bcc35b5410aeb179f4b32d11 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 18 Feb 2021 12:34:17 -0800 Subject: [PATCH] Remove dependency on internal VS utility apis. --- ...raceCompletionSessionProvider.BraceCompletionSession.cs | 1 - .../ChangeSignature/AddParameterDialogViewModel.cs | 7 +++---- .../Implementation/LanguageClient/InProcLanguageServer.cs | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/EditorFeatures/Core/Implementation/AutomaticCompletion/BraceCompletionSessionProvider.BraceCompletionSession.cs b/src/EditorFeatures/Core/Implementation/AutomaticCompletion/BraceCompletionSessionProvider.BraceCompletionSession.cs index 46c211d4f8094..f3664ecaeb406 100644 --- a/src/EditorFeatures/Core/Implementation/AutomaticCompletion/BraceCompletionSessionProvider.BraceCompletionSession.cs +++ b/src/EditorFeatures/Core/Implementation/AutomaticCompletion/BraceCompletionSessionProvider.BraceCompletionSession.cs @@ -17,7 +17,6 @@ using Microsoft.VisualStudio.Text.BraceCompletion; using Microsoft.VisualStudio.Text.Editor; using Microsoft.VisualStudio.Text.Operations; -using Microsoft.VisualStudio.Utilities.Internal; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Editor.Implementation.AutomaticCompletion diff --git a/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs b/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs index 70a5c03791bb0..adfe2d7dec0cb 100644 --- a/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs +++ b/src/VisualStudio/Core/Def/Implementation/ChangeSignature/AddParameterDialogViewModel.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.VisualStudio.LanguageServices.Implementation.Utilities; -using Microsoft.VisualStudio.Utilities.Internal; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ChangeSignature @@ -141,13 +140,13 @@ internal bool CanSubmit([NotNullWhen(false)] out string? message) return false; } - if (IsCallsiteRegularValue && CallSiteValue.IsNullOrWhiteSpace()) + if (IsCallsiteRegularValue && string.IsNullOrWhiteSpace(CallSiteValue)) { message = ServicesVSResources.Enter_a_call_site_value_or_choose_a_different_value_injection_kind; return false; } - if (IsOptional && DefaultValue.IsNullOrWhiteSpace()) + if (IsOptional && string.IsNullOrWhiteSpace(DefaultValue)) { message = ServicesVSResources.Optional_parameters_must_provide_a_default_value; return false; @@ -177,7 +176,7 @@ private void SetCurrentTypeTextAndUpdateBindingStatus(string typeName) { VerbatimTypeName = typeName; - if (typeName.IsNullOrWhiteSpace()) + if (string.IsNullOrWhiteSpace(typeName)) { TypeIsEmptyImage = Visibility.Visible; TypeDoesNotParseImage = Visibility.Collapsed; diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs b/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs index b207b9f173845..89ec34e382dea 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs @@ -19,7 +19,6 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Utilities.Internal; using Roslyn.Utilities; using StreamJsonRpc; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; @@ -558,7 +557,7 @@ internal async Task PublishDiagnosticsAsync(IDiagnosticService diagnosticService { // There were diagnostics from other documents, but none from the current document. // If we're tracking the current document, we can stop. - _publishedFileToDiagnostics.GetOrDefault(fileUri)?.Remove(document.Id); + ((IReadOnlyDictionary>>)_publishedFileToDiagnostics).GetValueOrDefault(fileUri)?.Remove(document.Id); _documentsToPublishedUris.MultiRemove(document.Id, fileUri); } } @@ -645,7 +644,7 @@ private static LSP.DiagnosticSeverity Convert(CodeAnalysis.DiagnosticSeverity se // In this case, unless we have a null client name, we don't want to publish the diagnostic // (since a null client name represents the C#/VB language server). private bool IncludeDiagnostic(DiagnosticData diagnostic) => - diagnostic.Properties.GetOrDefault(nameof(DocumentPropertiesService.DiagnosticsLspClientName)) == _clientName; + ((IReadOnlyDictionary)diagnostic.Properties).GetValueOrDefault(nameof(DocumentPropertiesService.DiagnosticsLspClientName)) == _clientName; private static LSP.Range GetDiagnosticRange(DiagnosticDataLocation diagnosticDataLocation, SourceText text) {