提交 c48a1433 编写于 作者: C CyrusNajmabadi

Remove property from FixAllCodeActio

nContext
上级 e19ea0cf
......@@ -301,7 +301,9 @@ public async Task<IEnumerable<CodeFixCollection>> GetFixesAsync(Document documen
}
result = result ?? new List<CodeFixCollection>();
var codeFix = new CodeFixCollection(fixer, span, fixes, fixAllProvider, fixAllContext, supportedScopes);
var codeFix = new CodeFixCollection(
fixer, span, fixes, fixAllProvider, fixAllContext,
supportedScopes, diagnostics.First());
result.Add(codeFix);
}
......
......@@ -49,6 +49,7 @@ internal class CodeFixSuggestedAction : SuggestedActionWithFlavors, ITelemetryDi
FixAllProvider fixAllProvider,
FixAllCodeActionContext fixAllCodeActionContext,
IEnumerable<FixAllScope> supportedScopes,
Diagnostic firstDiagnostic,
Workspace workspace,
ITextBuffer subjectBuffer,
ICodeActionEditHandlerService editHandler,
......@@ -71,8 +72,8 @@ internal class CodeFixSuggestedAction : SuggestedActionWithFlavors, ITelemetryDi
var fixAllContext = GetContextForScopeAndActionId(fixAllCodeActionContext, scope, action.EquivalenceKey);
var fixAllAction = new FixAllCodeAction(fixAllContext, fixAllProvider, showPreviewChangesDialog: true);
var fixAllSuggestedAction = new FixAllSuggestedAction(
workspace, subjectBuffer, editHandler, waitIndicator, fixAllAction, fixAllProvider,
fixAllCodeActionContext.OriginalDiagnostics.First(), operationListener);
workspace, subjectBuffer, editHandler, waitIndicator, fixAllAction,
fixAllProvider, firstDiagnostic, operationListener);
fixAllSuggestedActions.Add(fixAllSuggestedAction);
}
......
......@@ -285,7 +285,8 @@ private List<CodeFixCollection> FilterOnUIThread(List<CodeFixCollection> collect
: applicableFixes.Count == collection.Fixes.Length
? collection
: new CodeFixCollection(collection.Provider, collection.TextSpan, applicableFixes,
collection.FixAllProvider, collection.FixAllContext, collection.SupportedScopes);
collection.FixAllProvider, collection.FixAllContext,
collection.SupportedScopes, collection.FirstDiagnostic);
}
private bool IsApplicable(CodeAction action, Workspace workspace)
......@@ -349,8 +350,10 @@ private IEnumerable<SuggestedActionSet> OrganizeFixes(Workspace workspace, IEnum
Func<CodeAction, SuggestedActionSet> getFixAllSuggestedActionSet =
codeAction => CodeFixSuggestedAction.GetFixAllSuggestedActionSet(
codeAction, fixCount, fixCollection.FixAllProvider, fixCollection.FixAllContext, fixCollection.SupportedScopes,
workspace, _subjectBuffer, _owner._editHandler, _owner._waitIndicator, _owner._listener);
codeAction, fixCount, fixCollection.FixAllProvider,
fixCollection.FixAllContext, fixCollection.SupportedScopes,
fixCollection.FirstDiagnostic, workspace, _subjectBuffer,
_owner._editHandler, _owner._waitIndicator, _owner._listener);
foreach (var fix in fixes)
{
......
......@@ -144,7 +144,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
{
var codeFix = new CodeFixCollection(
fixer, diagnostic.Location.SourceSpan, fixes,
fixAllProvider: null, fixAllContext: null, supportedScopes: null);
fixAllProvider: null, fixAllContext: null, supportedScopes: null, firstDiagnostic: null);
result.Add(Tuple.Create(diagnostic, codeFix));
}
}
......@@ -165,7 +165,7 @@ protected Document GetDocumentAndAnnotatedSpan(TestWorkspace workspace, out stri
var diagnosticSpan = diagnostic.Location.IsInSource ? diagnostic.Location.SourceSpan : default(TextSpan);
var codeFix = new CodeFixCollection(
fixAllProvider, diagnosticSpan, ImmutableArray.Create(new CodeFix(document.Project, fixAllFix, diagnostic)),
fixAllProvider: null, fixAllContext: null, supportedScopes: null);
fixAllProvider: null, fixAllContext: null, supportedScopes: null, firstDiagnostic: null);
result.Add(Tuple.Create(diagnostic, codeFix));
}
}
......
......@@ -114,7 +114,8 @@ Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics
If fixes.Any() Then
result.Add(Tuple.Create(diagnostic, New CodeFixCollection(
fixer, diagnostic.Location.SourceSpan, fixes,
fixAllProvider:=Nothing, fixAllContext:=Nothing, supportedScopes:=Nothing)))
fixAllProvider:=Nothing, fixAllContext:=Nothing,
supportedScopes:=Nothing, firstDiagnostic:=Nothing)))
End If
Next
......
......@@ -23,6 +23,7 @@ internal class CodeFixCollection
public FixAllProvider FixAllProvider { get; }
public FixAllCodeActionContext FixAllContext { get; }
public IEnumerable<FixAllScope> SupportedScopes { get; }
public Diagnostic FirstDiagnostic { get; }
public CodeFixCollection(
object provider,
......@@ -30,8 +31,9 @@ internal class CodeFixCollection
IEnumerable<CodeFix> fixes,
FixAllProvider fixAllProvider,
FixAllCodeActionContext fixAllContext,
IEnumerable<FixAllScope> supportedScopes) :
this(provider, span, fixes.ToImmutableArray(), fixAllProvider, fixAllContext, supportedScopes)
IEnumerable<FixAllScope> supportedScopes,
Diagnostic firstDiagnostic) :
this(provider, span, fixes.ToImmutableArray(), fixAllProvider, fixAllContext, supportedScopes, firstDiagnostic)
{
}
......@@ -41,7 +43,8 @@ internal class CodeFixCollection
ImmutableArray<CodeFix> fixes,
FixAllProvider fixAllProvider,
FixAllCodeActionContext fixAllContext,
IEnumerable<FixAllScope> supportedScopes)
IEnumerable<FixAllScope> supportedScopes,
Diagnostic firstDiagnostic)
{
this.Provider = provider;
this.TextSpan = span;
......@@ -49,6 +52,7 @@ internal class CodeFixCollection
this.FixAllProvider = fixAllProvider;
this.FixAllContext = fixAllContext;
this.SupportedScopes = supportedScopes;
this.FirstDiagnostic = firstDiagnostic;
}
}
}
......@@ -81,13 +81,13 @@ private static IEnumerable<string> GetFixAllDiagnosticIds(FixAllProviderInfo fix
.Select(d => d.Id);
}
#if false
public IEnumerable<Diagnostic> OriginalDiagnostics
{
get { return _originalFixDiagnostics; }
}
#if false
public FixAllProvider FixAllProvider
{
get { return _fixAllProviderInfo.FixAllProvider; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册