提交 279ca2e8 编写于 作者: H Heejae Chang

code clean up following code review feedback

上级 95a1a0bd
......@@ -84,7 +84,7 @@ internal override IEnumerable<Diagnostic> GetDiagnostics(TestWorkspace workspace
var filteredDiagnostics = FilterDiagnostics(diagnostics);
var wrapperCodeFixer = new WrapperCodeFixProvider(fixer, filteredDiagnostics.Select(d => d.Id).Distinct().ToImmutableArray());
var wrapperCodeFixer = new WrapperCodeFixProvider(fixer, filteredDiagnostics.Select(d => d.Id));
return GetDiagnosticAndFixes(filteredDiagnostics, provider, wrapperCodeFixer, testDriver, document, span, annotation, fixAllActionId);
}
}
......
......@@ -274,7 +274,7 @@ public async Task<IEnumerable<CodeFixCollection>> GetFixesAsync(Document documen
FixAllCodeActionContext fixAllContext = null;
if (fixAllProviderInfo != null)
{
var codeFixProvider = (fixer as CodeFixProvider) ?? new WrapperCodeFixProvider((ISuppressionFixProvider)fixer, diagnostics.Select(d => d.Id).Distinct().ToImmutableArray());
var codeFixProvider = (fixer as CodeFixProvider) ?? new WrapperCodeFixProvider((ISuppressionFixProvider)fixer, diagnostics.Select(d => d.Id));
fixAllContext = FixAllCodeActionContext.Create(
document, fixAllProviderInfo, codeFixProvider, diagnostics,
this.GetDocumentDiagnosticsAsync, this.GetProjectDiagnosticsAsync, cancellationToken);
......@@ -288,7 +288,7 @@ public async Task<IEnumerable<CodeFixCollection>> GetFixesAsync(Document documen
return result;
}
public CodeFixProvider GetSuppressionFixer(string language, ImmutableArray<string> diagnosticIds)
public CodeFixProvider GetSuppressionFixer(string language, IEnumerable<string> diagnosticIds)
{
Lazy<ISuppressionFixProvider> lazySuppressionProvider;
if (!_suppressionProvidersMap.TryGetValue(language, out lazySuppressionProvider) || lazySuppressionProvider.Value == null)
......
......@@ -13,6 +13,6 @@ internal interface ICodeFixService
Task<FirstDiagnosticResult> GetFirstDiagnosticWithFixAsync(Document document, TextSpan textSpan, bool considerSuppressionFixes, CancellationToken cancellationToken);
Task<IEnumerable<CodeFixCollection>> GetFixesAsync(Document document, TextSpan textSpan, bool includeSuppressionFixes, CancellationToken cancellationToken);
CodeFixProvider GetSuppressionFixer(string language, ImmutableArray<string> diagnosticIds);
CodeFixProvider GetSuppressionFixer(string language, IEnumerable<string> diagnosticIds);
}
}
......@@ -12,10 +12,10 @@ internal sealed class WrapperCodeFixProvider : CodeFixProvider
private readonly ImmutableArray<string> _originalDiagnosticIds;
private readonly ISuppressionFixProvider _suppressionFixProvider;
public WrapperCodeFixProvider(ISuppressionFixProvider suppressionFixProvider, ImmutableArray<string> diagnosticIds)
public WrapperCodeFixProvider(ISuppressionFixProvider suppressionFixProvider, IEnumerable<string> diagnosticIds)
{
_suppressionFixProvider = suppressionFixProvider;
_originalDiagnosticIds = diagnosticIds;
_originalDiagnosticIds = diagnosticIds.Distinct().ToImmutableArray();
}
public ISuppressionFixProvider SuppressionFixProvider => _suppressionFixProvider;
......
......@@ -425,7 +425,7 @@ private WaitIndicatorResult InvokeWithWaitDialog(Action<CancellationToken> actio
private static CodeFixProvider GetSuppressionFixer(IEnumerable<Diagnostic> diagnostics, string language, ICodeFixService codeFixService)
{
// Fetch the suppression fixer to apply the fix.
return codeFixService.GetSuppressionFixer(language, diagnostics.Select(d => d.Id).Distinct().ToImmutableArray());
return codeFixService.GetSuppressionFixer(language, diagnostics.Select(d => d.Id));
}
private async Task<ImmutableDictionary<Document, ImmutableArray<Diagnostic>>> GetDocumentDiagnosticsToFixAsync(IEnumerable<DiagnosticData> diagnosticsToFix, Func<Project, bool> shouldFixInProject, bool filterStaleDiagnostics, CancellationToken cancellationToken)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册