Support diagnostics (declaration):
- Analyze if method has
Asyncsuffix - Analyze if method has
CancellationTokenparameter - Analyze if method's
CancellationTokenhas namecancellationToken - Analyze if
CancellationTokenis last parameter in method
Contains CodeFixes (declaration):
- Rename method name without
Asyncsuffix - Add missing
CancellationToken cancellationTokenparameter - Rename
CancellationTokenparameter tocancellationTokenwhen name is not matched - Reorder method parameters and put
CancellationTokenas last parameter
Support diagnostics (invocation):
- Analyze if
invokedmethod hasAsyncsuffix - Analyze if
invokedmethod hasCancellationTokenparameter- checks if
CancellationTokenparameter is present in scope where asynchronous method isinvokedand add possibility to use it - add possibility to enhance declaration and use
CancellationToken.None
- checks if
Contains CodeFixes (invocation):
- Rename method name without
Asyncsuffix - Add missing
CancellationToken cancellationTokenparameter- Add cancellation token to declaration and invocation (
CancellationToken.None) - Add cancellation token to declaration and invocation (reuse
cancellationTokenfrom method scope where is invoked)
- Add cancellation token to declaration and invocation (
Declaration:
async voidmethod declarationsTaskmethod declarationsasync Taskmethod declarationsTask<T>method declarationsasync Task<T>method declarations
Invocation:
async voidmethod invocationsTaskmethod invocationsasync Taskmethod invocationsTask<T>method invocationsasync Task<T>method invocations
Example Declaration:
public Task MyMethod() // => Declaration analyzers analyzers will rise diagnostics
{
}
Example Invocation:
public Task MyMethod()
{
return AnotherAsyncMethod(); // => invocation analyzers analyzers will rise diagnostics
}
- refactorings to remove code duplicity
- improve
Texts - add another
analyzersandcodefixes- reorder
Func<T,....>generics whenCancellationTokenis detected - reorder
Action<T,....>generics whenCancellationTokenis detected - detect and convert
async voidmethods toTaskmethods
- reorder
- improve automatic
simplification - add test code :D
