From 305ea351de8248d248bc6a273c7bb42d7baf626b Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Fri, 1 Nov 2019 07:35:19 -0700 Subject: [PATCH] Address feedback --- .../VisualStudioDiagnosticAnalyzerService.cs | 23 +++++++++++------- .../Core/Def/ServicesVSResources.Designer.cs | 24 ++++++++++++++++--- .../Core/Def/ServicesVSResources.resx | 10 ++++++-- .../Core/Def/xlf/ServicesVSResources.cs.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.de.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.es.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.fr.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.it.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.ja.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.ko.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.pl.xlf | 16 ++++++++++--- .../Def/xlf/ServicesVSResources.pt-BR.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.ru.xlf | 16 ++++++++++--- .../Core/Def/xlf/ServicesVSResources.tr.xlf | 16 ++++++++++--- .../Def/xlf/ServicesVSResources.zh-Hans.xlf | 16 ++++++++++--- .../Def/xlf/ServicesVSResources.zh-Hant.xlf | 16 ++++++++++--- 16 files changed, 213 insertions(+), 52 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs b/src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs index 875bd7ebef7..b487e1a3b54 100644 --- a/src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs +++ b/src/VisualStudio/Core/Def/Implementation/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs @@ -16,6 +16,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; +using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; using Roslyn.Utilities; @@ -34,6 +35,7 @@ internal partial class VisualStudioDiagnosticAnalyzerService : IVisualStudioDiag private readonly IDiagnosticAnalyzerService _diagnosticService; private readonly IThreadingContext _threadingContext; private readonly IVsHierarchyItemManager _vsHierarchyItemManager; + private readonly IAsynchronousOperationListener _listener; private IServiceProvider? _serviceProvider; @@ -42,12 +44,14 @@ internal partial class VisualStudioDiagnosticAnalyzerService : IVisualStudioDiag VisualStudioWorkspace workspace, IDiagnosticAnalyzerService diagnosticService, IThreadingContext threadingContext, - IVsHierarchyItemManager vsHierarchyItemManager) + IVsHierarchyItemManager vsHierarchyItemManager, + IAsynchronousOperationListenerProvider listenerProvider) { _workspace = workspace; _diagnosticService = diagnosticService; _threadingContext = threadingContext; _vsHierarchyItemManager = vsHierarchyItemManager; + _listener = listenerProvider.GetListener(FeatureAttribute.DiagnosticService); } public void Initialize(IServiceProvider serviceProvider) @@ -79,8 +83,6 @@ public void Initialize(IServiceProvider serviceProvider) } } - // *DO NOT DELETE* - // This is used by Ruleset Editor from ManagedSourceCodeAnalysis.dll. public IReadOnlyDictionary> GetAllDiagnosticDescriptors(IVsHierarchy? hierarchy) { if (hierarchy == null) @@ -173,23 +175,28 @@ private void OnRunCodeAnalysisForSelectedProject(object sender, EventArgs args) public void RunAnalyzers(IVsHierarchy? hierarchy) { var project = GetProject(hierarchy); - var projectOrSolutionName = project?.Name ?? PathUtilities.GetFileName(_workspace.CurrentSolution.FilePath) ?? "Solution"; + string? projectOrSolutionName = project?.Name ?? PathUtilities.GetFileName(_workspace.CurrentSolution.FilePath); // Add a message to VS status bar that we are running code analysis. - var waitDialogMessage = string.Format(ServicesVSResources.Running_code_analysis_for_0, projectOrSolutionName); + var statusMessage = projectOrSolutionName != null + ? string.Format(ServicesVSResources.Running_code_analysis_for_0, projectOrSolutionName) + : ServicesVSResources.Running_code_analysis_for_Solution; var statusBar = _serviceProvider?.GetService(typeof(SVsStatusbar)) as IVsStatusbar; - statusBar?.SetText(waitDialogMessage); + statusBar?.SetText(statusMessage); // Force complete analyzer execution in background. + var asyncToken = _listener.BeginAsyncOperation($"{nameof(VisualStudioDiagnosticAnalyzerService)}_{nameof(RunAnalyzers)}"); Task.Run(async () => { await _diagnosticService.ForceAnalyzeAsync(_workspace.CurrentSolution, project?.Id, CancellationToken.None).ConfigureAwait(false); // Add a message to VS status bar that we completed executing code analysis. await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(); - var notificationMesage = string.Format(ServicesVSResources.Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh, projectOrSolutionName); + var notificationMesage = projectOrSolutionName != null + ? string.Format(ServicesVSResources.Code_analysis_completed_for_0, projectOrSolutionName) + : ServicesVSResources.Code_analysis_completed_for_Solution; statusBar?.SetText(notificationMesage); - }); + }).CompletesAsyncOperation(asyncToken); } private Project? GetProject(IVsHierarchy? hierarchy) diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs index 3c2b380312f..e65d01bdfc7 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs +++ b/src/VisualStudio/Core/Def/ServicesVSResources.Designer.cs @@ -588,11 +588,20 @@ internal class ServicesVSResources { } /// - /// Looks up a localized string similar to Code analysis completed for '{0}'. Please wait for the error list to refresh.. + /// Looks up a localized string similar to Code analysis completed for '{0}'.. /// - internal static string Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh { + internal static string Code_analysis_completed_for_0 { get { - return ResourceManager.GetString("Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh", resourceCulture); + return ResourceManager.GetString("Code_analysis_completed_for_0", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Code analysis completed for Solution.. + /// + internal static string Code_analysis_completed_for_Solution { + get { + return ResourceManager.GetString("Code_analysis_completed_for_Solution", resourceCulture); } } @@ -2826,6 +2835,15 @@ internal class ServicesVSResources { } } + /// + /// Looks up a localized string similar to Running code analysis for Solution.... + /// + internal static string Running_code_analysis_for_Solution { + get { + return ResourceManager.GetString("Running_code_analysis_for_Solution", resourceCulture); + } + } + /// /// Looks up a localized string similar to Running low priority background processes. /// diff --git a/src/VisualStudio/Core/Def/ServicesVSResources.resx b/src/VisualStudio/Core/Def/ServicesVSResources.resx index 3e3dc02e60c..10797861ccb 100644 --- a/src/VisualStudio/Core/Def/ServicesVSResources.resx +++ b/src/VisualStudio/Core/Def/ServicesVSResources.resx @@ -1338,7 +1338,13 @@ I agree to all of the foregoing: Running code analysis for '{0}'... - - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Running code analysis for Solution... + + + Code analysis completed for '{0}'. + + + Code analysis completed for Solution. \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf index 49ebec51772..3ddf21cd881 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.cs.xlf @@ -77,9 +77,14 @@ Klasifikace - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Spouštění procesů s nízkou prioritou na pozadí diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf index 86d121e6d56..d4f2119725c 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.de.xlf @@ -77,9 +77,14 @@ Klassifizierungen - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Hintergrundprozesse mit niedriger Priorität werden ausgeführt. diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf index 3290a15b001..1519ea7a8e6 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.es.xlf @@ -77,9 +77,14 @@ Clasificaciones - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Ejecutando procesos en segundo plano de baja prioridad diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf index 8308f4a33bd..80011ade76c 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.fr.xlf @@ -77,9 +77,14 @@ Classifications - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Exécution des processus d’arrière-plan basse priorité diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf index 6696fd7f8f5..7d604da01ef 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.it.xlf @@ -77,9 +77,14 @@ Classificazioni - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Esecuzione di processi in background con priorità bassa diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf index b861d92b794..54ebf108604 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ja.xlf @@ -77,9 +77,14 @@ 分類 - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes 優先度の低いバックグラウンド プロセスを実行しています diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf index e32b194dfe7..778cb7668c9 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ko.xlf @@ -77,9 +77,14 @@ 분류 - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes 낮은 우선 순위 백그라운드 프로세스 실행 중 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf index 720b69179b4..3940ab4b9a9 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pl.xlf @@ -77,9 +77,14 @@ Klasyfikacje - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Uruchamianie procesów w tle o niskim priorytecie diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf index 6d616edb780..8316b3289d6 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.pt-BR.xlf @@ -77,9 +77,14 @@ Classificações - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Executando processos de baixa prioridade em segundo plano diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf index f7e216b9038..eeba5c544d1 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.ru.xlf @@ -77,9 +77,14 @@ Классификации - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Запуск фоновых процессов с низким приоритетом diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf index 4047ecf407a..1287a8d8e01 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.tr.xlf @@ -77,9 +77,14 @@ Sınıflandırmalar - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes Düşük öncelikli arka plan işlemleri çalıştırılıyor diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf index 6fc0656f796..3b9a2922bbc 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hans.xlf @@ -77,9 +77,14 @@ 分类 - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes 正在运行低优先级后台进程 diff --git a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf index 74c7eeff4b9..356587392e8 100644 --- a/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf +++ b/src/VisualStudio/Core/Def/xlf/ServicesVSResources.zh-Hant.xlf @@ -77,9 +77,14 @@ 分類 - - Code analysis completed for '{0}'. Please wait for the error list to refresh. - Code analysis completed for '{0}'. Please wait for the error list to refresh. + + Code analysis completed for '{0}'. + Code analysis completed for '{0}'. + + + + Code analysis completed for Solution. + Code analysis completed for Solution. @@ -442,6 +447,11 @@ Running code analysis for '{0}'... + + Running code analysis for Solution... + Running code analysis for Solution... + + Running low priority background processes 正在執行低優先順序背景流程 -- GitLab