提交 d18ebedc 编写于 作者: S Sam Harwell

Remove unused interface IInProcessAnalyzer

上级 88b5f373
......@@ -67,10 +67,6 @@ public static bool IsOpenFileOnly(this DiagnosticAnalyzer analyzer, Workspace wo
return false;
}
[Obsolete("In-process analyzer restrictions are obsolete.")]
public static bool IsInProcessOnly(this DiagnosticAnalyzer analyzer)
=> analyzer is IInProcessAnalyzer;
public static bool ContainsOpenFileOnlyAnalyzers(this CompilationWithAnalyzers analyzerDriverOpt, Workspace workspace)
{
if (analyzerDriverOpt == null)
......
......@@ -60,29 +60,9 @@ public InProcOrRemoteHostAnalyzerRunner(DiagnosticAnalyzerService owner, Abstrac
return await AnalyzeInProcAsync(analyzerDriver, project, cancellationToken).ConfigureAwait(false);
}
// due to in-process only analyzers, we need to run inproc as well for such analyzers for fix all
// otherwise, we don't need to run open file only analyzers for closed files even if full solution analysis is on (perf improvement)
//
// we have this open file analyzers since some of our built in analyzers such as SimplifyTypeNamesDiagnosticAnalyzer are too
// slow to run for whole solution when full solution analysis is on. easily taking more than an hour to run whole solution.
#pragma warning disable CS0618 // Type or member is obsolete
var inProcResultTask = AnalyzeInProcAsync(CreateAnalyzerDriver(analyzerDriver, a => (forcedAnalysis || !a.IsOpenFileOnly(workspace)) && a.IsInProcessOnly()), project, remoteHostClient, cancellationToken);
#pragma warning restore CS0618 // Type or member is obsolete
// out of proc analysis will use 2 source of analyzers. one is AnalyzerReference from project (nuget). and the other is host analyzers (vsix)
// that are not part of roslyn solution. these host analyzers must be sync to OOP before hand by the Host.
var outOfProcResultTask = AnalyzeOutOfProcAsync(remoteHostClient, analyzerDriver, project, forcedAnalysis, cancellationToken);
// run them concurrently in vs and remote host
await Task.WhenAll(inProcResultTask, outOfProcResultTask).ConfigureAwait(false);
// make sure things are not cancelled
cancellationToken.ThrowIfCancellationRequested();
// merge 2 results
return DiagnosticAnalysisResultMap.Create(
inProcResultTask.Result.AnalysisResult.AddRange(outOfProcResultTask.Result.AnalysisResult),
inProcResultTask.Result.TelemetryInfo.AddRange(outOfProcResultTask.Result.TelemetryInfo));
return await AnalyzeOutOfProcAsync(remoteHostClient, analyzerDriver, project, forcedAnalysis, cancellationToken).ConfigureAwait(false);
}
private Task<DiagnosticAnalysisResultMap<DiagnosticAnalyzer, DiagnosticAnalysisResult>> AnalyzeInProcAsync(
......@@ -151,9 +131,7 @@ private async Task FireAndForgetReportAnalyzerPerformanceAsync(Project project,
{
var analyzerMap = pooledObject.Object;
#pragma warning disable CS0618 // Type or member is obsolete
analyzerMap.AppendAnalyzerMap(analyzerDriver.Analyzers.Where(a => !a.IsInProcessOnly() && (forcedAnalysis || !a.IsOpenFileOnly(solution.Workspace))));
#pragma warning restore CS0618 // Type or member is obsolete
analyzerMap.AppendAnalyzerMap(analyzerDriver.Analyzers.Where(a => forcedAnalysis || !a.IsOpenFileOnly(solution.Workspace)));
if (analyzerMap.Count == 0)
{
return DiagnosticAnalysisResultMap.Create(ImmutableDictionary<DiagnosticAnalyzer, DiagnosticAnalysisResult>.Empty, ImmutableDictionary<DiagnosticAnalyzer, AnalyzerTelemetryInfo>.Empty);
......@@ -187,18 +165,6 @@ private async Task FireAndForgetReportAnalyzerPerformanceAsync(Project project,
}
}
private CompilationWithAnalyzers CreateAnalyzerDriver(CompilationWithAnalyzers analyzerDriver, Func<DiagnosticAnalyzer, bool> predicate)
{
var analyzers = analyzerDriver.Analyzers.Where(predicate).ToImmutableArray();
if (analyzers.Length == 0)
{
// return null since we can't create CompilationWithAnalyzers with 0 analyzers
return null;
}
return analyzerDriver.Compilation.WithAnalyzers(analyzers, analyzerDriver.AnalysisOptions);
}
private CustomAsset GetOptionsAsset(Solution solution, string language, CancellationToken cancellationToken)
{
// TODO: we need better way to deal with options. optionSet itself is green node but
......
// 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;
namespace Microsoft.CodeAnalysis.Diagnostics
{
/// <summary>
/// A marker interface for <see cref="DiagnosticAnalyzer"/> implementations that do not support out-of-process
/// execution.
/// </summary>
[Obsolete("Diagnostic analyzers must not be restricted in in-process analysis.", error: true)]
internal interface IInProcessAnalyzer
{
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册