Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thread in the correct cancellation token into the code action operation #68859

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public bool IsFixableDiagnostic(Diagnostic diagnostic)
=> null;

public Task<ImmutableArray<CodeFix>> GetFixesAsync(TextDocument document, TextSpan span, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken)
=> Task.FromResult(GetConfigurations(document.Project, diagnostics, cancellationToken));
=> Task.FromResult(GetConfigurations(document.Project, diagnostics));

public Task<ImmutableArray<CodeFix>> GetFixesAsync(Project project, IEnumerable<Diagnostic> diagnostics, CodeActionOptionsProvider fallbackOptions, CancellationToken cancellationToken)
=> Task.FromResult(GetConfigurations(project, diagnostics, cancellationToken));
=> Task.FromResult(GetConfigurations(project, diagnostics));

private static ImmutableArray<CodeFix> GetConfigurations(Project project, IEnumerable<Diagnostic> diagnostics, CancellationToken cancellationToken)
private static ImmutableArray<CodeFix> GetConfigurations(Project project, IEnumerable<Diagnostic> diagnostics)
{
var result = ArrayBuilder<CodeFix>.GetInstance();
foreach (var diagnostic in diagnostics)
Expand Down Expand Up @@ -150,7 +150,7 @@ void AddCodeActionWithOptionValue(ICodeStyleOption codeStyleOption, object newVa
nestedActions.Add(
SolutionChangeAction.Create(
optionValue,
solution => ConfigurationUpdater.ConfigureCodeStyleOptionAsync(optionName, optionValue, diagnostic, option.IsPerLanguage, project, cancellationToken),
cancellationToken => ConfigurationUpdater.ConfigureCodeStyleOptionAsync(optionName, optionValue, diagnostic, option.IsPerLanguage, project, cancellationToken),
optionValue));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static ImmutableArray<CodeFix> GetConfigurations(Project project, IEnume
nestedActions.Add(
SolutionChangeAction.Create(
title,
solution => ConfigurationUpdater.ConfigureSeverityAsync(value, diagnostic, project, cancellationToken),
cancellationToken => ConfigurationUpdater.ConfigureSeverityAsync(value, diagnostic, project, cancellationToken),
value));
}

Expand Down