Skip to content
This repository was archived by the owner on Nov 8, 2018. It is now read-only.

Commit a0fba43

Browse files
committed
Add equivalence keys for code fixes
1 parent 0c62733 commit a0fba43

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

AsyncUsageAnalyzers/AsyncUsageAnalyzers.CodeFixes/Naming/AvoidAsyncSuffixCodeFixProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
4242

4343
var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
4444
var newName = token.ValueText.Substring(0, token.ValueText.Length - "Async".Length);
45-
context.RegisterCodeFix(CodeAction.Create($"Rename method to '{newName}'", cancellationToken => RenameHelper.RenameSymbolAsync(document, root, token, newName, cancellationToken)), diagnostic);
45+
context.RegisterCodeFix(
46+
CodeAction.Create(
47+
$"Rename method to '{newName}'",
48+
cancellationToken => RenameHelper.RenameSymbolAsync(document, root, token, newName, cancellationToken),
49+
nameof(AvoidAsyncSuffixCodeFixProvider)),
50+
diagnostic);
4651
}
4752
}
4853
}

AsyncUsageAnalyzers/AsyncUsageAnalyzers.CodeFixes/Naming/UseAsyncSuffixCodeFixProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
4242

4343
var token = root.FindToken(diagnostic.Location.SourceSpan.Start);
4444
var newName = token.ValueText + "Async";
45-
context.RegisterCodeFix(CodeAction.Create($"Rename method to '{newName}'", cancellationToken => RenameHelper.RenameSymbolAsync(document, root, token, newName, cancellationToken)), diagnostic);
45+
context.RegisterCodeFix(
46+
CodeAction.Create(
47+
$"Rename method to '{newName}'",
48+
cancellationToken => RenameHelper.RenameSymbolAsync(document, root, token, newName, cancellationToken),
49+
nameof(UseAsyncSuffixCodeFixProvider)),
50+
diagnostic);
4651
}
4752
}
4853
}

AsyncUsageAnalyzers/AsyncUsageAnalyzers.CodeFixes/Usage/UseConfigureAwaitCodeFixProvider.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context)
4040
continue;
4141
}
4242

43-
context.RegisterCodeFix(CodeAction.Create("Use ConfigureAwait(false)", cancellationToken => GetTransformedDocumentAsync(context.Document, diagnostic, cancellationToken)), diagnostic);
43+
context.RegisterCodeFix(
44+
CodeAction.Create(
45+
"Use ConfigureAwait(false)",
46+
cancellationToken => GetTransformedDocumentAsync(context.Document, diagnostic, cancellationToken),
47+
nameof(UseConfigureAwaitCodeFixProvider) + "_False"),
48+
diagnostic);
4449
}
4550

4651
return Task.FromResult(true);

0 commit comments

Comments
 (0)