Skip to content

Commit

Permalink
Merge pull request dotnet#53371 from ryzngard/issues/52475_changename…
Browse files Browse the repository at this point in the history
…space_checkchangesupported

Check the workspace supports ApplyChangesKind.ChangeDocumentInfo
  • Loading branch information
ryzngard authored May 19, 2021
2 parents 0cd3742 + 4ca3372 commit 2bedbd5
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ internal abstract partial class AbstractChangeNamespaceToMatchFolderCodeFixProvi

public override Task RegisterCodeFixesAsync(CodeFixContext context)
{
context.RegisterCodeFix(
new MyCodeAction(AnalyzersResources.Change_namespace_to_match_folder_structure, cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics, cancellationToken)),
context.Diagnostics);
if (context.Document.Project.Solution.Workspace.CanApplyChange(ApplyChangesKind.ChangeDocumentInfo))
{
context.RegisterCodeFix(
new MyCodeAction(AnalyzersResources.Change_namespace_to_match_folder_structure, cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics, cancellationToken)),
context.Diagnostics);
}

return Task.CompletedTask;
}
Expand Down

0 comments on commit 2bedbd5

Please sign in to comment.