提交 305ea351 编写于 作者: M Manish Vasani

Address feedback

上级 38e4eda4
......@@ -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<string, IEnumerable<DiagnosticDescriptor>> 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)
......
......@@ -588,11 +588,20 @@ internal class ServicesVSResources {
}
/// <summary>
/// Looks up a localized string similar to Code analysis completed for &apos;{0}&apos;. Please wait for the error list to refresh..
/// Looks up a localized string similar to Code analysis completed for &apos;{0}&apos;..
/// </summary>
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);
}
}
/// <summary>
/// Looks up a localized string similar to Code analysis completed for Solution..
/// </summary>
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 {
}
}
/// <summary>
/// Looks up a localized string similar to Running code analysis for Solution....
/// </summary>
internal static string Running_code_analysis_for_Solution {
get {
return ResourceManager.GetString("Running_code_analysis_for_Solution", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Running low priority background processes.
/// </summary>
......
......@@ -1338,7 +1338,13 @@ I agree to all of the foregoing:</value>
<data name="Running_code_analysis_for_0" xml:space="preserve">
<value>Running code analysis for '{0}'...</value>
</data>
<data name="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh" xml:space="preserve">
<value>Code analysis completed for '{0}'. Please wait for the error list to refresh.</value>
<data name="Running_code_analysis_for_Solution" xml:space="preserve">
<value>Running code analysis for Solution...</value>
</data>
<data name="Code_analysis_completed_for_0" xml:space="preserve">
<value>Code analysis completed for '{0}'.</value>
</data>
<data name="Code_analysis_completed_for_Solution" xml:space="preserve">
<value>Code analysis completed for Solution.</value>
</data>
</root>
\ No newline at end of file
......@@ -77,9 +77,14 @@
<target state="translated">Klasifikace</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Spouštění procesů s nízkou prioritou na pozadí</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Klassifizierungen</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Hintergrundprozesse mit niedriger Priorität werden ausgeführt.</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Clasificaciones</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Ejecutando procesos en segundo plano de baja prioridad</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Classifications</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Exécution des processus d’arrière-plan basse priorité</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Classificazioni</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Esecuzione di processi in background con priorità bassa</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">分類</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">優先度の低いバックグラウンド プロセスを実行しています</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">분류</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">낮은 우선 순위 백그라운드 프로세스 실행 중</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Klasyfikacje</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Uruchamianie procesów w tle o niskim priorytecie</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Classificações</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Executando processos de baixa prioridade em segundo plano</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Классификации</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Запуск фоновых процессов с низким приоритетом</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">Sınıflandırmalar</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">Düşük öncelikli arka plan işlemleri çalıştırılıyor</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">分类</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">正在运行低优先级后台进程</target>
......
......@@ -77,9 +77,14 @@
<target state="translated">分類</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_0_Please_wait_for_the_error_list_to_refresh">
<source>Code analysis completed for '{0}'. Please wait for the error list to refresh.</source>
<target state="new">Code analysis completed for '{0}'. Please wait for the error list to refresh.</target>
<trans-unit id="Code_analysis_completed_for_0">
<source>Code analysis completed for '{0}'.</source>
<target state="new">Code analysis completed for '{0}'.</target>
<note />
</trans-unit>
<trans-unit id="Code_analysis_completed_for_Solution">
<source>Code analysis completed for Solution.</source>
<target state="new">Code analysis completed for Solution.</target>
<note />
</trans-unit>
<trans-unit id="Colorize_regular_expressions">
......@@ -442,6 +447,11 @@
<target state="new">Running code analysis for '{0}'...</target>
<note />
</trans-unit>
<trans-unit id="Running_code_analysis_for_Solution">
<source>Running code analysis for Solution...</source>
<target state="new">Running code analysis for Solution...</target>
<note />
</trans-unit>
<trans-unit id="Running_low_priority_background_processes">
<source>Running low priority background processes</source>
<target state="translated">正在執行低優先順序背景流程</target>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册